rubocop 0.80.1 → 0.81.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/config/default.yml +62 -15
  4. data/lib/rubocop.rb +4 -1
  5. data/lib/rubocop/ast/builder.rb +2 -0
  6. data/lib/rubocop/ast/node.rb +11 -6
  7. data/lib/rubocop/ast/node/block_node.rb +5 -1
  8. data/lib/rubocop/ast/node/case_match_node.rb +56 -0
  9. data/lib/rubocop/ast/traversal.rb +11 -9
  10. data/lib/rubocop/config_obsoletion.rb +1 -0
  11. data/lib/rubocop/cop/layout/array_alignment.rb +53 -10
  12. data/lib/rubocop/cop/layout/block_end_newline.rb +5 -3
  13. data/lib/rubocop/cop/layout/else_alignment.rb +8 -0
  14. data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +1 -1
  15. data/lib/rubocop/cop/lint/boolean_symbol.rb +12 -0
  16. data/lib/rubocop/cop/lint/erb_new_arguments.rb +1 -1
  17. data/lib/rubocop/cop/lint/loop.rb +6 -4
  18. data/lib/rubocop/cop/lint/nested_method_definition.rb +2 -2
  19. data/lib/rubocop/cop/lint/raise_exception.rb +39 -0
  20. data/lib/rubocop/cop/lint/safe_navigation_chain.rb +1 -1
  21. data/lib/rubocop/cop/lint/struct_new_override.rb +58 -0
  22. data/lib/rubocop/cop/lint/suppressed_exception.rb +12 -22
  23. data/lib/rubocop/cop/lint/unused_method_argument.rb +32 -6
  24. data/lib/rubocop/cop/migration/department_name.rb +22 -9
  25. data/lib/rubocop/cop/mixin/end_keyword_alignment.rb +6 -1
  26. data/lib/rubocop/cop/mixin/method_complexity.rb +5 -0
  27. data/lib/rubocop/cop/naming/method_name.rb +30 -0
  28. data/lib/rubocop/cop/style/access_modifier_declarations.rb +26 -6
  29. data/lib/rubocop/cop/style/collection_methods.rb +2 -0
  30. data/lib/rubocop/cop/style/documentation.rb +43 -5
  31. data/lib/rubocop/cop/style/end_block.rb +6 -0
  32. data/lib/rubocop/cop/style/hash_each_methods.rb +2 -0
  33. data/lib/rubocop/cop/style/hash_transform_keys.rb +6 -2
  34. data/lib/rubocop/cop/style/hash_transform_values.rb +6 -2
  35. data/lib/rubocop/cop/style/inverse_methods.rb +1 -1
  36. data/lib/rubocop/cop/style/lambda.rb +1 -0
  37. data/lib/rubocop/cop/style/module_function.rb +56 -10
  38. data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +2 -2
  39. data/lib/rubocop/cop/style/one_line_conditional.rb +3 -2
  40. data/lib/rubocop/cop/style/redundant_sort.rb +2 -2
  41. data/lib/rubocop/cop/style/trailing_comma_in_arguments.rb +34 -0
  42. data/lib/rubocop/cop/style/trailing_comma_in_array_literal.rb +41 -0
  43. data/lib/rubocop/cop/style/trailing_comma_in_block_args.rb +85 -0
  44. data/lib/rubocop/cop/style/trailing_comma_in_hash_literal.rb +44 -0
  45. data/lib/rubocop/formatter/clang_style_formatter.rb +1 -1
  46. data/lib/rubocop/formatter/junit_formatter.rb +17 -6
  47. data/lib/rubocop/formatter/tap_formatter.rb +1 -1
  48. data/lib/rubocop/processed_source.rb +1 -1
  49. data/lib/rubocop/version.rb +1 -1
  50. metadata +8 -5
  51. 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