Skip to content

Commit 30434cf

Browse files
committed
Fix rubocop offenses
1 parent e9bce65 commit 30434cf

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

lib/pmdtester/builders/diff_report/violations.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# frozen_string_literal: true
2+
23
require 'differ'
34

45
# Contains methods to write out html for the violations.
@@ -75,7 +76,7 @@ def build_violation_table_row(doc, key, pmd_violation)
7576
end
7677

7778
def diff_fragments(doc, violation)
78-
old_message = violation.attrs["oldMessage"]
79+
old_message = violation.attrs['oldMessage']
7980
new_message = violation.text
8081
diff = Differ.diff_by_word(old_message, new_message)
8182
doc << diff.format_as(:html)

lib/pmdtester/builders/html_report_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def copy_css(report_dir)
4747
FileUtils.copy_entry(CSS_SRC_DIR, css_dest_dir)
4848
end
4949

50-
def build_table_content_for(doc, removed_size, new_size, changed_size=nil)
50+
def build_table_content_for(doc, removed_size, new_size, changed_size = nil)
5151
doc.span(class: 'removed') { doc.text "-#{removed_size}" }
5252
if changed_size
5353
doc.text ' | '

lib/pmdtester/pmd_violation.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ def initialize(attrs, branch)
5959
@text = ''
6060
end
6161

62-
def is_same_modulo_message?(other)
62+
def same_modulo_message?(other)
6363
@attrs['beginline'].eql?(other.attrs['beginline']) &&
64-
@attrs['rule'].eql?(other.attrs['rule'])
64+
@attrs['rule'].eql?(other.attrs['rule'])
6565
end
6666

6767
def try_merge?(other)
68-
if branch != BASE && @branch != other.branch && is_same_modulo_message?(other)
68+
if branch != BASE && @branch != other.branch && same_modulo_message?(other)
6969
@changed = true
7070
@attrs['oldMessage'] = other.text
7171
true
@@ -75,7 +75,7 @@ def try_merge?(other)
7575
end
7676

7777
def eql?(other)
78-
is_same_modulo_message?(other) &&
78+
same_modulo_message?(other) &&
7979
@text.eql?(other.text)
8080
end
8181

lib/pmdtester/report_diff.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ def build_diffs(base_hash, patch_hash)
146146
# @param diff_violations a hash { filename => list[violation]}, containing those that changed
147147
def merge_changed_violations(diff_violations)
148148
diff_violations.each do |fname, different|
149-
diff_violations[fname] = different.dup.delete_if { |v|
149+
diff_violations[fname] = different.dup.delete_if do |v|
150150
v.branch == BASE &&
151-
# try_merge will set v2.changed = true if it succeeds
152-
different.any? { |v2| v2.try_merge?(v) }
153-
}
151+
# try_merge will set v2.changed = true if it succeeds
152+
different.any? { |v2| v2.try_merge?(v) }
153+
end
154154
end
155155
end
156156

0 commit comments

Comments
 (0)