Skip to content

Commit

Permalink
Avoid use of ProcessedSource#commented?
Browse files Browse the repository at this point in the history
  • Loading branch information
marcandre authored and bbatsov committed Aug 10, 2020
1 parent 28eabb7 commit 9a08fde
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/rubocop/cop/mixin/check_line_breakable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def extract_breakable_node_from_elements(node, elements, max)
return if safe_to_ignore?(node)

line = processed_source.lines[node.first_line - 1]
return if processed_source.commented?(node.loc.begin)
return if processed_source.line_with_comment?(node.loc.line)
return if line.length <= max

extract_first_element_over_column_limit(node, elements, max)
Expand Down
4 changes: 2 additions & 2 deletions lib/rubocop/cop/mixin/statement_modifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ def single_line_as_modifier?(node)
def non_eligible_node?(node)
node.modifier_form? ||
node.nonempty_line_count > 3 ||
processed_source.commented?(node.loc.end)
processed_source.line_with_comment?(node.loc.last_line)
end

def non_eligible_body?(body)
body.nil? ||
body.empty_source? ||
body.begin_type? ||
processed_source.commented?(body.source_range)
processed_source.contains_comment?(body.source_range)
end

def non_eligible_condition?(condition)
Expand Down

0 comments on commit 9a08fde

Please sign in to comment.