rubocop 0.80.1 → 0.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/config/default.yml +62 -15
- data/lib/rubocop.rb +4 -1
- data/lib/rubocop/ast/builder.rb +2 -0
- data/lib/rubocop/ast/node.rb +11 -6
- data/lib/rubocop/ast/node/block_node.rb +5 -1
- data/lib/rubocop/ast/node/case_match_node.rb +56 -0
- data/lib/rubocop/ast/traversal.rb +11 -9
- data/lib/rubocop/config_obsoletion.rb +1 -0
- data/lib/rubocop/cop/layout/array_alignment.rb +53 -10
- data/lib/rubocop/cop/layout/block_end_newline.rb +5 -3
- data/lib/rubocop/cop/layout/else_alignment.rb +8 -0
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +1 -1
- data/lib/rubocop/cop/lint/boolean_symbol.rb +12 -0
- data/lib/rubocop/cop/lint/erb_new_arguments.rb +1 -1
- data/lib/rubocop/cop/lint/loop.rb +6 -4
- data/lib/rubocop/cop/lint/nested_method_definition.rb +2 -2
- data/lib/rubocop/cop/lint/raise_exception.rb +39 -0
- data/lib/rubocop/cop/lint/safe_navigation_chain.rb +1 -1
- data/lib/rubocop/cop/lint/struct_new_override.rb +58 -0
- data/lib/rubocop/cop/lint/suppressed_exception.rb +12 -22
- data/lib/rubocop/cop/lint/unused_method_argument.rb +32 -6
- data/lib/rubocop/cop/migration/department_name.rb +22 -9
- data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +6 -1
- data/lib/rubocop/cop/mixin/method_complexity.rb +5 -0
- data/lib/rubocop/cop/naming/method_name.rb +30 -0
- data/lib/rubocop/cop/style/access_modifier_declarations.rb +26 -6
- data/lib/rubocop/cop/style/collection_methods.rb +2 -0
- data/lib/rubocop/cop/style/documentation.rb +43 -5
- data/lib/rubocop/cop/style/end_block.rb +6 -0
- data/lib/rubocop/cop/style/hash_each_methods.rb +2 -0
- data/lib/rubocop/cop/style/hash_transform_keys.rb +6 -2
- data/lib/rubocop/cop/style/hash_transform_values.rb +6 -2
- data/lib/rubocop/cop/style/inverse_methods.rb +1 -1
- data/lib/rubocop/cop/style/lambda.rb +1 -0
- data/lib/rubocop/cop/style/module_function.rb +56 -10
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +2 -2
- data/lib/rubocop/cop/style/one_line_conditional.rb +3 -2
- data/lib/rubocop/cop/style/redundant_sort.rb +2 -2
- data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +34 -0
- data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +41 -0
- data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +85 -0
- data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +44 -0
- data/lib/rubocop/formatter/clang_style_formatter.rb +1 -1
- data/lib/rubocop/formatter/junit_formatter.rb +17 -6
- data/lib/rubocop/formatter/tap_formatter.rb +1 -1
- data/lib/rubocop/processed_source.rb +1 -1
- data/lib/rubocop/version.rb +1 -1
- metadata +8 -5
- data/lib/rubocop/cop/lint/end_in_method.rb +0 -40
@@ -1,40 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module Cop
|
5
|
-
module Lint
|
6
|
-
# This cop checks for END blocks in method definitions.
|
7
|
-
#
|
8
|
-
# @example
|
9
|
-
#
|
10
|
-
# # bad
|
11
|
-
#
|
12
|
-
# def some_method
|
13
|
-
# END { do_something }
|
14
|
-
# end
|
15
|
-
#
|
16
|
-
# @example
|
17
|
-
#
|
18
|
-
# # good
|
19
|
-
#
|
20
|
-
# def some_method
|
21
|
-
# at_exit { do_something }
|
22
|
-
# end
|
23
|
-
#
|
24
|
-
# @example
|
25
|
-
#
|
26
|
-
# # good
|
27
|
-
#
|
28
|
-
# # outside defs
|
29
|
-
# END { do_something }
|
30
|
-
class EndInMethod < Cop
|
31
|
-
MSG = '`END` found in method definition. Use `at_exit` instead.'
|
32
|
-
|
33
|
-
def on_postexe(node)
|
34
|
-
inside_of_method = node.each_ancestor(:def, :defs).count.nonzero?
|
35
|
-
add_offense(node, location: :keyword) if inside_of_method
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|