Skip to content

Commit

Permalink
[#499] Ignore custom rubocop code while running Rubocop on generated …
Browse files Browse the repository at this point in the history
…projects
  • Loading branch information
Goose97 committed Apr 11, 2024
1 parent b80b449 commit 6b91a81
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ AllCops:
- 'node_modules/**/*'
- 'config/**/*'
- 'tmp/**/*'
- 'rubocop/**/*'
TargetRubyVersion: 3
NewCops: enable

Expand Down
8 changes: 6 additions & 2 deletions rubocop/custom_cops/class_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,17 @@ def error_message(out_of_order_expression, expressions)
# rubocop:enable Metrics/MethodLength

def before_first_expression(current_expression, out_of_order_expression)
return unless EXPRESSION_TYPE_ORDER[out_of_order_expression] < EXPRESSION_TYPE_ORDER[current_expression[:category]]
unless EXPRESSION_TYPE_ORDER[out_of_order_expression] < EXPRESSION_TYPE_ORDER[current_expression[:category]]
return
end

"#{out_of_order_expression} should come before `#{current_expression[:expression].source}`."
end

def after_last_expression(current_expression, out_of_order_expression)
return unless EXPRESSION_TYPE_ORDER[out_of_order_expression] > EXPRESSION_TYPE_ORDER[current_expression[:category]]
unless EXPRESSION_TYPE_ORDER[out_of_order_expression] > EXPRESSION_TYPE_ORDER[current_expression[:category]]
return
end

"#{out_of_order_expression} should come after `#{current_expression[:expression].source}`."
end
Expand Down

0 comments on commit 6b91a81

Please sign in to comment.