rubocop 1.30.0 → 1.31.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/config/default.yml +41 -8
- data/config/obsoletion.yml +2 -0
- data/exe/rubocop +15 -7
- data/lib/rubocop/cli/command/auto_genenerate_config.rb +1 -1
- data/lib/rubocop/cli/command/suggest_extensions.rb +3 -3
- data/lib/rubocop/config.rb +4 -0
- data/lib/rubocop/config_loader.rb +1 -0
- data/lib/rubocop/config_validator.rb +9 -5
- data/lib/rubocop/cop/base.rb +4 -0
- data/lib/rubocop/cop/bundler/duplicated_gem.rb +1 -1
- data/lib/rubocop/cop/bundler/gem_filename.rb +4 -4
- data/lib/rubocop/cop/bundler/ordered_gems.rb +2 -2
- data/lib/rubocop/cop/corrector.rb +2 -2
- data/lib/rubocop/cop/correctors/multiline_literal_brace_corrector.rb +3 -3
- data/lib/rubocop/cop/correctors/unused_arg_corrector.rb +1 -1
- data/lib/rubocop/cop/gemspec/deprecated_attribute_assignment.rb +31 -16
- data/lib/rubocop/cop/gemspec/duplicated_assignment.rb +1 -1
- data/lib/rubocop/cop/gemspec/ordered_dependencies.rb +1 -1
- data/lib/rubocop/cop/gemspec/require_mfa.rb +20 -20
- data/lib/rubocop/cop/generator.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/node_matcher_directive.rb +1 -5
- data/lib/rubocop/cop/internal_affairs/redundant_location_argument.rb +1 -1
- data/lib/rubocop/cop/internal_affairs/redundant_message_argument.rb +1 -1
- data/lib/rubocop/cop/layout/argument_alignment.rb +1 -1
- data/lib/rubocop/cop/layout/empty_comment.rb +1 -1
- data/lib/rubocop/cop/layout/empty_lines_around_attribute_accessor.rb +25 -4
- data/lib/rubocop/cop/layout/empty_lines_around_block_body.rb +4 -4
- data/lib/rubocop/cop/layout/empty_lines_around_class_body.rb +9 -9
- data/lib/rubocop/cop/layout/empty_lines_around_module_body.rb +9 -9
- data/lib/rubocop/cop/layout/first_argument_indentation.rb +27 -27
- data/lib/rubocop/cop/layout/first_array_element_indentation.rb +17 -11
- data/lib/rubocop/cop/layout/first_hash_element_indentation.rb +49 -10
- data/lib/rubocop/cop/layout/initial_indentation.rb +1 -1
- data/lib/rubocop/cop/layout/line_continuation_leading_space.rb +68 -0
- data/lib/rubocop/cop/layout/line_continuation_spacing.rb +120 -0
- data/lib/rubocop/cop/layout/multiline_block_layout.rb +1 -1
- data/lib/rubocop/cop/layout/multiline_method_call_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/multiline_operation_indentation.rb +2 -2
- data/lib/rubocop/cop/layout/space_around_block_parameters.rb +1 -1
- data/lib/rubocop/cop/layout/space_around_operators.rb +1 -1
- data/lib/rubocop/cop/layout/space_before_block_braces.rb +1 -1
- data/lib/rubocop/cop/layout/space_before_first_arg.rb +1 -1
- data/lib/rubocop/cop/layout/space_inside_array_literal_brackets.rb +10 -10
- data/lib/rubocop/cop/layout/space_inside_block_braces.rb +5 -3
- data/lib/rubocop/cop/layout/trailing_empty_lines.rb +7 -7
- data/lib/rubocop/cop/layout/trailing_whitespace.rb +1 -1
- data/lib/rubocop/cop/lint/constant_overwritten_in_rescue.rb +51 -0
- data/lib/rubocop/cop/lint/interpolation_check.rb +1 -1
- data/lib/rubocop/cop/lint/non_atomic_file_operation.rb +121 -0
- data/lib/rubocop/cop/lint/number_conversion.rb +3 -3
- data/lib/rubocop/cop/lint/parentheses_as_grouped_expression.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_cop_disable_directive.rb +5 -5
- data/lib/rubocop/cop/lint/redundant_cop_enable_directive.rb +1 -1
- data/lib/rubocop/cop/lint/redundant_require_statement.rb +1 -1
- data/lib/rubocop/cop/lint/regexp_as_condition.rb +2 -2
- data/lib/rubocop/cop/lint/struct_new_override.rb +2 -2
- data/lib/rubocop/cop/lint/trailing_comma_in_attribute_declaration.rb +1 -1
- data/lib/rubocop/cop/lint/useless_else_without_rescue.rb +44 -0
- data/lib/rubocop/cop/metrics/utils/code_length_calculator.rb +1 -1
- data/lib/rubocop/cop/mixin/multiline_element_indentation.rb +36 -12
- data/lib/rubocop/cop/mixin/range_help.rb +7 -3
- data/lib/rubocop/cop/naming/accessor_method_name.rb +3 -1
- data/lib/rubocop/cop/naming/variable_number.rb +17 -17
- data/lib/rubocop/cop/style/accessor_grouping.rb +1 -1
- data/lib/rubocop/cop/style/and_or.rb +8 -8
- data/lib/rubocop/cop/style/arguments_forwarding.rb +1 -1
- data/lib/rubocop/cop/style/block_delimiters.rb +4 -2
- data/lib/rubocop/cop/style/commented_keyword.rb +1 -1
- data/lib/rubocop/cop/style/conditional_assignment.rb +1 -0
- data/lib/rubocop/cop/style/empty_else.rb +10 -10
- data/lib/rubocop/cop/style/empty_method.rb +16 -1
- data/lib/rubocop/cop/style/encoding.rb +1 -1
- data/lib/rubocop/cop/style/explicit_block_argument.rb +1 -1
- data/lib/rubocop/cop/style/fetch_env_var.rb +9 -2
- data/lib/rubocop/cop/style/format_string_token.rb +48 -17
- data/lib/rubocop/cop/style/frozen_string_literal_comment.rb +1 -1
- data/lib/rubocop/cop/style/guard_clause.rb +8 -6
- data/lib/rubocop/cop/style/hash_as_last_array_item.rb +1 -1
- data/lib/rubocop/cop/style/hash_except.rb +88 -8
- data/lib/rubocop/cop/style/hash_syntax.rb +2 -2
- data/lib/rubocop/cop/style/implicit_runtime_error.rb +2 -2
- data/lib/rubocop/cop/style/keyword_parameters_order.rb +1 -1
- data/lib/rubocop/cop/style/line_end_concatenation.rb +1 -1
- data/lib/rubocop/cop/style/map_to_hash.rb +1 -1
- data/lib/rubocop/cop/style/method_call_with_args_parentheses/omit_parentheses.rb +2 -2
- data/lib/rubocop/cop/style/missing_else.rb +24 -24
- data/lib/rubocop/cop/style/multiline_if_modifier.rb +2 -2
- data/lib/rubocop/cop/style/multiline_if_then.rb +1 -1
- data/lib/rubocop/cop/style/multiline_in_pattern_then.rb +1 -3
- data/lib/rubocop/cop/style/multiline_method_signature.rb +1 -1
- data/lib/rubocop/cop/style/multiline_ternary_operator.rb +1 -1
- data/lib/rubocop/cop/style/multiline_when_then.rb +1 -3
- data/lib/rubocop/cop/style/nested_parenthesized_calls.rb +1 -1
- data/lib/rubocop/cop/style/nested_ternary_operator.rb +19 -7
- data/lib/rubocop/cop/style/nil_lambda.rb +1 -1
- data/lib/rubocop/cop/style/not.rb +1 -1
- data/lib/rubocop/cop/style/redundant_argument.rb +1 -1
- data/lib/rubocop/cop/style/redundant_return.rb +1 -1
- data/lib/rubocop/cop/style/redundant_self_assignment.rb +1 -1
- data/lib/rubocop/cop/style/rescue_standard_error.rb +10 -10
- data/lib/rubocop/cop/style/safe_navigation.rb +3 -0
- data/lib/rubocop/cop/style/sole_nested_conditional.rb +2 -2
- data/lib/rubocop/cop/style/string_concatenation.rb +5 -6
- data/lib/rubocop/cop/style/struct_inheritance.rb +2 -2
- data/lib/rubocop/cop/style/swap_values.rb +1 -1
- data/lib/rubocop/cop/style/symbol_proc.rb +1 -1
- data/lib/rubocop/cop/style/unpack_first.rb +1 -1
- data/lib/rubocop/cop/util.rb +1 -1
- data/lib/rubocop/cops_documentation_generator.rb +18 -1
- data/lib/rubocop/formatter/disabled_config_formatter.rb +8 -5
- data/lib/rubocop/formatter/formatter_set.rb +20 -19
- data/lib/rubocop/formatter/git_hub_actions_formatter.rb +15 -2
- data/lib/rubocop/formatter/html_formatter.rb +0 -1
- data/lib/rubocop/formatter/offense_count_formatter.rb +2 -0
- data/lib/rubocop/formatter/simple_text_formatter.rb +6 -9
- data/lib/rubocop/formatter.rb +31 -0
- data/lib/rubocop/options.rb +25 -2
- data/lib/rubocop/rake_task.rb +30 -9
- data/lib/rubocop/runner.rb +2 -2
- data/lib/rubocop/server/cache.rb +109 -0
- data/lib/rubocop/server/cli.rb +104 -0
- data/lib/rubocop/server/client_command/base.rb +44 -0
- data/lib/rubocop/server/client_command/exec.rb +59 -0
- data/lib/rubocop/server/client_command/restart.rb +25 -0
- data/lib/rubocop/server/client_command/start.rb +43 -0
- data/lib/rubocop/server/client_command/status.rb +28 -0
- data/lib/rubocop/server/client_command/stop.rb +31 -0
- data/lib/rubocop/server/client_command.rb +26 -0
- data/lib/rubocop/server/core.rb +79 -0
- data/lib/rubocop/server/errors.rb +23 -0
- data/lib/rubocop/server/helper.rb +34 -0
- data/lib/rubocop/server/server_command/base.rb +50 -0
- data/lib/rubocop/server/server_command/exec.rb +34 -0
- data/lib/rubocop/server/server_command/stop.rb +24 -0
- data/lib/rubocop/server/server_command.rb +21 -0
- data/lib/rubocop/server/socket_reader.rb +65 -0
- data/lib/rubocop/server.rb +53 -0
- data/lib/rubocop/version.rb +15 -8
- data/lib/rubocop.rb +7 -26
- metadata +27 -4
- data/lib/rubocop/cop/gemspec/date_assignment.rb +0 -49
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module RuboCop
|
4
|
-
module Cop
|
5
|
-
module Gemspec
|
6
|
-
# Checks that `date =` is not used in gemspec file.
|
7
|
-
# It is set automatically when the gem is packaged.
|
8
|
-
#
|
9
|
-
# @example
|
10
|
-
#
|
11
|
-
# # bad
|
12
|
-
# Gem::Specification.new do |spec|
|
13
|
-
# spec.name = 'your_cool_gem_name'
|
14
|
-
# spec.date = Time.now.strftime('%Y-%m-%d')
|
15
|
-
# end
|
16
|
-
#
|
17
|
-
# # good
|
18
|
-
# Gem::Specification.new do |spec|
|
19
|
-
# spec.name = 'your_cool_gem_name'
|
20
|
-
# end
|
21
|
-
#
|
22
|
-
class DateAssignment < Base
|
23
|
-
include RangeHelp
|
24
|
-
include GemspecHelp
|
25
|
-
extend AutoCorrector
|
26
|
-
|
27
|
-
MSG = 'Do not use `date =` in gemspec, it is set automatically when the gem is packaged.'
|
28
|
-
|
29
|
-
def on_block(block_node)
|
30
|
-
return unless gem_specification?(block_node)
|
31
|
-
|
32
|
-
block_parameter = block_node.arguments.first.source
|
33
|
-
|
34
|
-
date_assignment = block_node.descendants.detect do |node|
|
35
|
-
node.send_type? && node.receiver&.source == block_parameter && node.method?(:date=)
|
36
|
-
end
|
37
|
-
|
38
|
-
return unless date_assignment
|
39
|
-
|
40
|
-
add_offense(date_assignment) do |corrector|
|
41
|
-
range = range_by_whole_lines(date_assignment.source_range, include_final_newline: true)
|
42
|
-
|
43
|
-
corrector.remove(range)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|