rubocop 0.71.0 → 0.72.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 +4 -8
 - data/config/default.yml +42 -484
 - data/lib/rubocop.rb +5 -53
 - data/lib/rubocop/ast/builder.rb +2 -0
 - data/lib/rubocop/ast/node.rb +1 -1
 - data/lib/rubocop/ast/node/float_node.rb +12 -0
 - data/lib/rubocop/ast/node/int_node.rb +12 -0
 - data/lib/rubocop/ast/node/mixin/numeric_node.rb +21 -0
 - data/lib/rubocop/ast/node/resbody_node.rb +1 -6
 - data/lib/rubocop/cached_data.rb +1 -1
 - data/lib/rubocop/config.rb +34 -5
 - data/lib/rubocop/config_loader.rb +2 -6
 - data/lib/rubocop/config_loader_resolver.rb +0 -14
 - data/lib/rubocop/cop/cop.rb +0 -4
 - data/lib/rubocop/cop/gemspec/ruby_version_globals_usage.rb +55 -0
 - data/lib/rubocop/cop/layout/class_structure.rb +1 -1
 - data/lib/rubocop/cop/layout/indent_first_argument.rb +6 -2
 - data/lib/rubocop/cop/layout/indent_first_parameter.rb +7 -3
 - data/lib/rubocop/cop/layout/indent_heredoc.rb +0 -1
 - data/lib/rubocop/cop/layout/indentation_consistency.rb +13 -12
 - data/lib/rubocop/cop/layout/indentation_width.rb +8 -4
 - data/lib/rubocop/cop/lint/number_conversion.rb +1 -1
 - data/lib/rubocop/cop/naming/rescued_exceptions_variable_name.rb +21 -20
 - data/lib/rubocop/cop/style/commented_keyword.rb +1 -1
 - data/lib/rubocop/cop/style/conditional_assignment.rb +2 -1
 - data/lib/rubocop/cop/style/float_division.rb +94 -0
 - data/lib/rubocop/cop/style/format_string.rb +7 -3
 - data/lib/rubocop/cop/style/if_inside_else.rb +42 -0
 - data/lib/rubocop/cop/style/method_call_with_args_parentheses.rb +7 -1
 - data/lib/rubocop/cop/style/safe_navigation.rb +1 -1
 - data/lib/rubocop/cop/style/ternary_parentheses.rb +12 -2
 - data/lib/rubocop/cop/style/word_array.rb +2 -2
 - data/lib/rubocop/cop/style/zero_length_predicate.rb +1 -1
 - data/lib/rubocop/options.rb +0 -2
 - data/lib/rubocop/processed_source.rb +2 -1
 - data/lib/rubocop/rspec/cop_helper.rb +0 -1
 - data/lib/rubocop/rspec/shared_contexts.rb +0 -17
 - data/lib/rubocop/rspec/support.rb +0 -1
 - data/lib/rubocop/runner.rb +0 -17
 - data/lib/rubocop/version.rb +1 -1
 - data/lib/rubocop/yaml_duplication_checker.rb +8 -2
 - metadata +8 -91
 - data/lib/rubocop/cop/mixin/target_rails_version.rb +0 -16
 - data/lib/rubocop/cop/rails/action_filter.rb +0 -117
 - data/lib/rubocop/cop/rails/active_record_aliases.rb +0 -48
 - data/lib/rubocop/cop/rails/active_record_override.rb +0 -82
 - data/lib/rubocop/cop/rails/active_support_aliases.rb +0 -69
 - data/lib/rubocop/cop/rails/application_job.rb +0 -40
 - data/lib/rubocop/cop/rails/application_record.rb +0 -40
 - data/lib/rubocop/cop/rails/assert_not.rb +0 -44
 - data/lib/rubocop/cop/rails/belongs_to.rb +0 -102
 - data/lib/rubocop/cop/rails/blank.rb +0 -164
 - data/lib/rubocop/cop/rails/bulk_change_table.rb +0 -289
 - data/lib/rubocop/cop/rails/create_table_with_timestamps.rb +0 -91
 - data/lib/rubocop/cop/rails/date.rb +0 -161
 - data/lib/rubocop/cop/rails/delegate.rb +0 -132
 - data/lib/rubocop/cop/rails/delegate_allow_blank.rb +0 -37
 - data/lib/rubocop/cop/rails/dynamic_find_by.rb +0 -91
 - data/lib/rubocop/cop/rails/enum_uniqueness.rb +0 -45
 - data/lib/rubocop/cop/rails/environment_comparison.rb +0 -68
 - data/lib/rubocop/cop/rails/exit.rb +0 -67
 - data/lib/rubocop/cop/rails/file_path.rb +0 -108
 - data/lib/rubocop/cop/rails/find_by.rb +0 -55
 - data/lib/rubocop/cop/rails/find_each.rb +0 -51
 - data/lib/rubocop/cop/rails/has_and_belongs_to_many.rb +0 -25
 - data/lib/rubocop/cop/rails/has_many_or_has_one_dependent.rb +0 -106
 - data/lib/rubocop/cop/rails/http_positional_arguments.rb +0 -117
 - data/lib/rubocop/cop/rails/http_status.rb +0 -179
 - data/lib/rubocop/cop/rails/ignored_skip_action_filter_option.rb +0 -94
 - data/lib/rubocop/cop/rails/inverse_of.rb +0 -246
 - data/lib/rubocop/cop/rails/lexically_scoped_action_filter.rb +0 -175
 - data/lib/rubocop/cop/rails/link_to_blank.rb +0 -98
 - data/lib/rubocop/cop/rails/not_null_column.rb +0 -67
 - data/lib/rubocop/cop/rails/output.rb +0 -49
 - data/lib/rubocop/cop/rails/output_safety.rb +0 -99
 - data/lib/rubocop/cop/rails/pluralization_grammar.rb +0 -107
 - data/lib/rubocop/cop/rails/presence.rb +0 -124
 - data/lib/rubocop/cop/rails/present.rb +0 -153
 - data/lib/rubocop/cop/rails/read_write_attribute.rb +0 -74
 - data/lib/rubocop/cop/rails/redundant_allow_nil.rb +0 -111
 - data/lib/rubocop/cop/rails/redundant_receiver_in_with_options.rb +0 -136
 - data/lib/rubocop/cop/rails/reflection_class_name.rb +0 -37
 - data/lib/rubocop/cop/rails/refute_methods.rb +0 -76
 - data/lib/rubocop/cop/rails/relative_date_constant.rb +0 -93
 - data/lib/rubocop/cop/rails/request_referer.rb +0 -56
 - data/lib/rubocop/cop/rails/reversible_migration.rb +0 -286
 - data/lib/rubocop/cop/rails/safe_navigation.rb +0 -87
 - data/lib/rubocop/cop/rails/save_bang.rb +0 -316
 - data/lib/rubocop/cop/rails/scope_args.rb +0 -29
 - data/lib/rubocop/cop/rails/skips_model_validations.rb +0 -87
 - data/lib/rubocop/cop/rails/time_zone.rb +0 -238
 - data/lib/rubocop/cop/rails/uniq_before_pluck.rb +0 -105
 - data/lib/rubocop/cop/rails/unknown_env.rb +0 -63
 - data/lib/rubocop/cop/rails/validation.rb +0 -109
 - data/lib/rubocop/rspec/shared_examples.rb +0 -59
 
| 
         @@ -1,59 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            # `cop` and `source` must be declared with #let.
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            RSpec.shared_examples_for 'misaligned' do |annotated_source, used_style|
         
     | 
| 
       6 
     | 
    
         
            -
              config_to_allow_offenses = if used_style
         
     | 
| 
       7 
     | 
    
         
            -
                                           { 'EnforcedStyleAlignWith' => used_style.to_s }
         
     | 
| 
       8 
     | 
    
         
            -
                                         else
         
     | 
| 
       9 
     | 
    
         
            -
                                           { 'Enabled' => false }
         
     | 
| 
       10 
     | 
    
         
            -
                                         end
         
     | 
| 
       11 
     | 
    
         
            -
              annotated_source.strip_indent.split(/\n\n/).each do |chunk|
         
     | 
| 
       12 
     | 
    
         
            -
                chunk << "\n" unless chunk.end_with?("\n")
         
     | 
| 
       13 
     | 
    
         
            -
                source = chunk.lines.reject { |line| line =~ /^ *\^/ }.join
         
     | 
| 
       14 
     | 
    
         
            -
                name = source.gsub(/\n(?=[a-z ])/, ' <newline> ').gsub(/\s+/, ' ')
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                it "registers an offense for mismatched #{name}" do
         
     | 
| 
       17 
     | 
    
         
            -
                  expect_offense(chunk)
         
     | 
| 
       18 
     | 
    
         
            -
                  expect(cop.config_to_allow_offenses).to eq(config_to_allow_offenses)
         
     | 
| 
       19 
     | 
    
         
            -
                end
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                it "auto-corrects mismatched #{name}" do
         
     | 
| 
       22 
     | 
    
         
            -
                  raise if chunk !~
         
     | 
| 
       23 
     | 
    
         
            -
                           /\^\^\^ `end` at (\d), \d is not aligned with `.*` at \d, (\d)./
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
                  line_index = Integer(Regexp.last_match(1)) - 1
         
     | 
| 
       26 
     | 
    
         
            -
                  correct_indentation = ' ' * Integer(Regexp.last_match(2))
         
     | 
| 
       27 
     | 
    
         
            -
                  expect(autocorrect_source(source))
         
     | 
| 
       28 
     | 
    
         
            -
                    .to eq(source.lines[0...line_index].join +
         
     | 
| 
       29 
     | 
    
         
            -
                           "#{correct_indentation}#{source.lines[line_index].strip}\n")
         
     | 
| 
       30 
     | 
    
         
            -
                end
         
     | 
| 
       31 
     | 
    
         
            -
              end
         
     | 
| 
       32 
     | 
    
         
            -
            end
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
            RSpec.shared_examples_for 'aligned' do |alignment_base, arg, end_kw, name|
         
     | 
| 
       35 
     | 
    
         
            -
              name ||= alignment_base
         
     | 
| 
       36 
     | 
    
         
            -
              name = name.gsub(/\n/, ' <newline>')
         
     | 
| 
       37 
     | 
    
         
            -
              it "accepts matching #{name} ... end" do
         
     | 
| 
       38 
     | 
    
         
            -
                inspect_source("#{alignment_base} #{arg}\n#{end_kw}")
         
     | 
| 
       39 
     | 
    
         
            -
                expect(cop.offenses).to be_empty
         
     | 
| 
       40 
     | 
    
         
            -
              end
         
     | 
| 
       41 
     | 
    
         
            -
            end
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
            RSpec.shared_examples_for 'debugger' do |name, src|
         
     | 
| 
       44 
     | 
    
         
            -
              it "reports an offense for a #{name} call" do
         
     | 
| 
       45 
     | 
    
         
            -
                inspect_source(src)
         
     | 
| 
       46 
     | 
    
         
            -
                src = [src] if src.is_a? String
         
     | 
| 
       47 
     | 
    
         
            -
                expect(cop.offenses.size).to eq(src.size)
         
     | 
| 
       48 
     | 
    
         
            -
                expect(cop.messages)
         
     | 
| 
       49 
     | 
    
         
            -
                  .to eq(src.map { |s| "Remove debugger entry point `#{s}`." })
         
     | 
| 
       50 
     | 
    
         
            -
                expect(cop.highlights).to eq(src)
         
     | 
| 
       51 
     | 
    
         
            -
              end
         
     | 
| 
       52 
     | 
    
         
            -
            end
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
       54 
     | 
    
         
            -
            RSpec.shared_examples_for 'non-debugger' do |name, src|
         
     | 
| 
       55 
     | 
    
         
            -
              it "does not report an offense for #{name}" do
         
     | 
| 
       56 
     | 
    
         
            -
                inspect_source(src)
         
     | 
| 
       57 
     | 
    
         
            -
                expect(cop.offenses).to be_empty
         
     | 
| 
       58 
     | 
    
         
            -
              end
         
     | 
| 
       59 
     | 
    
         
            -
            end
         
     |