summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin Ziegler <austin@zieglers.ca>2021-12-23 10:54:52 -0500
committerAustin Ziegler <austin@zieglers.ca>2022-07-04 20:26:10 -0400
commitf5781c06b2c297caf58c97824c77f557831094a7 (patch)
treefbb662bcb068c52bd20604b32b83e8c73da2d8c5
parent089f932537a540af9c27dd03caf30eff6b4a0306 (diff)
downloaddiff-lcs-f5781c06b2c297caf58c97824c77f557831094a7.tar.gz
ignore Layout/heredocIndentation due to old Ruby
-rw-r--r--.standard.yml2
-rw-r--r--Rakefile2
-rw-r--r--lib/diff/lcs/htmldiff.rb6
-rw-r--r--lib/diff/lcs/ldiff.rb2
-rw-r--r--spec/issues_spec.rb4
5 files changed, 16 insertions, 0 deletions
diff --git a/.standard.yml b/.standard.yml
index 4d5683c..227fe7b 100644
--- a/.standard.yml
+++ b/.standard.yml
@@ -2,3 +2,5 @@ parallel: true
ruby_version: 2.0
ignore:
- 'diff-lcs.gemspec'
+ - 'research/**/*'
+ - 'pkg/**/*'
diff --git a/Rakefile b/Rakefile
index 3924134..f5c4f80 100644
--- a/Rakefile
+++ b/Rakefile
@@ -105,6 +105,7 @@ if RUBY_VERSION >= "2.0" && RUBY_ENGINE == "ruby"
end
task :ruby18 do
+ # standard:disable Layout/HeredocIndentation
puts <<-MESSAGE
You are starting a barebones Ruby 1.8 docker environment. You will need to
do the following:
@@ -117,5 +118,6 @@ do the following:
Don't forget to restore your Gemfile.lock after testing.
MESSAGE
+ # standard:enable Layout/HeredocIndentation
sh "docker run -it --rm -v #{Dir.pwd}:/root/diff-lcs bellbind/docker-ruby18-rails2 bash -l"
end
diff --git a/lib/diff/lcs/htmldiff.rb b/lib/diff/lcs/htmldiff.rb
index a66c9ed..37bbc4a 100644
--- a/lib/diff/lcs/htmldiff.rb
+++ b/lib/diff/lcs/htmldiff.rb
@@ -53,6 +53,7 @@ class Diff::LCS::HTMLDiff
:title => nil
}.freeze
+ # standard:disable Layout/HeredocIndentation
DEFAULT_CSS = <<-CSS
body { margin: 0; }
.diff
@@ -86,6 +87,7 @@ pre
}
h1 { margin-left: 2em; }
CSS
+ # standard:enable Layout/HeredocIndentation
def initialize(left, right, options = nil)
@left = left
@@ -123,6 +125,7 @@ h1 { margin-left: 2em; }
@left.map! do |line| CGI.escapeHTML(line.chomp) end
@right.map! do |line| CGI.escapeHTML(line.chomp) end
+ # standard:disable Layout/HeredocIndentation
@options[:output] << <<-OUTPUT
<html>
<head>
@@ -137,14 +140,17 @@ h1 { margin-left: 2em; }
<span class="only_b">Only in New</span></p>
<div class="diff">
OUTPUT
+ # standard:enable Layout/HeredocIndentation
callbacks = Callbacks.new(@options[:output])
Diff::LCS.traverse_sequences(@left, @right, callbacks)
+ # standard:disable Layout/HeredocIndentation
@options[:output] << <<-OUTPUT
</div>
</body>
</html>
OUTPUT
+ # standard:enable Layout/HeredocIndentation
end
end
diff --git a/lib/diff/lcs/ldiff.rb b/lib/diff/lcs/ldiff.rb
index 2cbd704..59625aa 100644
--- a/lib/diff/lcs/ldiff.rb
+++ b/lib/diff/lcs/ldiff.rb
@@ -5,6 +5,7 @@ require "ostruct"
require "diff/lcs/hunk"
module Diff::LCS::Ldiff #:nodoc:
+ # standard:disable Layout/HeredocIndentation
BANNER = <<-COPYRIGHT
ldiff #{Diff::LCS::VERSION}
Copyright 2004-2019 Austin Ziegler
@@ -16,6 +17,7 @@ ldiff #{Diff::LCS::VERSION}
the terms of the GPL version 2 (or later), the Perl Artistic licence, or the
MIT licence.
COPYRIGHT
+ # standard:enable Layout/HeredocIndentation
end
class << Diff::LCS::Ldiff
diff --git a/spec/issues_spec.rb b/spec/issues_spec.rb
index abe524e..ec2abeb 100644
--- a/spec/issues_spec.rb
+++ b/spec/issues_spec.rb
@@ -68,6 +68,7 @@ describe "Diff::LCS Issues" do
describe "issue #60" do
it "should produce unified output with correct context" do
+ # standard:disable Layout/HeredocIndentation
old_data = <<-DATA_OLD.strip.split("\n").map(&:chomp)
{
"name": "x",
@@ -93,6 +94,7 @@ describe "Diff::LCS Issues" do
+ "description": "lo"
}
EXPECTED
+ # standard:enable Layout/HeredocIndentation
end
end
@@ -133,6 +135,7 @@ describe "Diff::LCS Issues" do
"recipe[q::new]", "recipe[r::new]"
]
+ # standard:disable Layout/HeredocIndentation
expect(diff_lines(old_data, new_data)).to eq(<<-EODIFF)
@@ -1,5 +1,4 @@
recipe[a::default]
@@ -149,6 +152,7 @@ describe "Diff::LCS Issues" do
+recipe[q::new]
+recipe[r::new]
EODIFF
+ # standard:enable Layout/HeredocIndentation
end
end
end