Skip to content

Commit

Permalink
Fix InternalAffairs/SingleLineComparison issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvandersluis committed Aug 4, 2022
1 parent 9a2cb04 commit 7695e0f
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/rubocop/cop/layout/multiline_assignment_layout.rb
Expand Up @@ -73,7 +73,7 @@ def check_assignment(node, rhs)
return if node.send_type? && node.loc.operator&.source != '='
return unless rhs
return unless supported_types.include?(rhs.type)
return if rhs.first_line == rhs.last_line
return if rhs.single_line?

check_by_enforced_style(node, rhs)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/style/if_unless_modifier.rb
Expand Up @@ -96,7 +96,7 @@ def too_long_single_line?(node)
return false unless max_line_length

range = node.source_range
return false unless range.first_line == range.last_line
return false unless range.single_line?
return false unless line_length_enabled_at_line?(range.first_line)

line = range.source_line
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/formatter/clang_style_formatter.rb
Expand Up @@ -41,7 +41,7 @@ def valid_line?(offense)
def report_line(location)
source_line = location.source_line

if location.first_line == location.last_line
if location.single_line?
output.puts(source_line)
else
output.puts("#{source_line} #{yellow(ELLIPSES)}")
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/formatter/html_formatter.rb
Expand Up @@ -115,7 +115,7 @@ def source_after_highlight(offense)
end

def possible_ellipses(location)
location.first_line == location.last_line ? '' : " #{ELLIPSES}"
location.single_line? ? '' : " #{ELLIPSES}"
end

def escape(string)
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/formatter/markdown_formatter.rb
Expand Up @@ -71,7 +71,7 @@ def write_code(offense)
end

def possible_ellipses(location)
location.first_line == location.last_line ? '' : ' ...'
location.single_line? ? '' : ' ...'
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/formatter/tap_formatter.rb
Expand Up @@ -29,7 +29,7 @@ def file_finished(file, offenses)
def report_line(location)
source_line = location.source_line

if location.first_line == location.last_line
if location.single_line?
output.puts("# #{source_line}")
else
output.puts("# #{source_line} #{yellow(ELLIPSES)}")
Expand Down

0 comments on commit 7695e0f

Please sign in to comment.