From 1b549a305087169c3f730511c42093c4c67571bd Mon Sep 17 00:00:00 2001 From: Issy Long Date: Mon, 10 Oct 2022 18:54:28 +0000 Subject: [PATCH 01/17] config/default: Unset `DisabledByDefault: true` - The `DisabledByDefault` config option made it so that "all cops in the default configuration are disabled, and only cops in user configuration are enabled", which makes cops "opt-in rather than opt-out" (source: https://github.com/rubocop/rubocop/blob/d1270c468cdb9a211229e36aef8d568ae3bfe607/config/default.yml#L91-L102). - It's not immediately obvious that this gem has this config option, and it's used in a lot of GitHub Ruby projects. This means that people may write new, custom cops in downstream projects, with no configuration in `.rubocop.yml`, and then they never run because all cops are disabled unless explicitly enabled or otherwise configured with `Include`/`Exclude`. - This change is a follow-up to the great conversations had in https://github.com/github/rubocop-github/pull/117, and makes this gem take a more neutral stance to match whatever RuboCop's defaults are for enabling (or not) cops. Then it's up to the maintainers of this gem and the deciders of our styleguide to pick the settings for the rules to include, and/or it's up to the downstream consumers of this gem to decide whether they want all the rules or just some of the rules as they are defined in here. --- config/default.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/config/default.yml b/config/default.yml index 67af72a..f04a02b 100644 --- a/config/default.yml +++ b/config/default.yml @@ -2,9 +2,6 @@ require: - rubocop/cop/github - rubocop-performance -AllCops: - DisabledByDefault: true - Bundler/DuplicatedGem: Enabled: true From 7df97a71204a8bf09eb97f87818b5fc90de09e4f Mon Sep 17 00:00:00 2001 From: Issy Long Date: Mon, 10 Oct 2022 19:32:03 +0000 Subject: [PATCH 02/17] rubocop.yml: Disable some cops locally that aren't in the styleguide - This config applies only to this repo, it's not the global config. --- .rubocop.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index 802a6e6..593983b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,33 @@ inherit_from: ./config/default.yml +AllCops: + SuggestExtensions: false + +Gemspec/RequiredRubyVersion: + Enabled: false + +Lint/AssignmentInCondition: + Enabled: false + +Lint/EmptyConditionalBody: + Enabled: false + +Lint/UselessAssignment: + Enabled: false + Naming/FileName: Enabled: true Exclude: - "rubocop-github.gemspec" + +Style/Documentation: + Enabled: false + +Style/GuardClause: + Enabled: false + +Style/Next: + Enabled: false + +Style/SoleNestedConditional: + Enabled: false From 53a0a37784c3d95c05edbc3f57023072b00ef607 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Mon, 10 Oct 2022 19:32:38 +0000 Subject: [PATCH 03/17] Run `bundle exec rubocop -a` (or `-A`) on all the code in this repo - These rules seemed to make sense and were all autocorrectable: - Style/SymbolArray - Layout/EmptyLineAfterGuardClause - Style/MultipleComparison - Style/IfUnlessModifier (since we don't have line length limitations) - Style/EmptyCaseCondition - Style/TrailingUnderscoreVariable - Style/RedundantParentheses - Lint/UnusedBlockArgument - Style/NegatedIf - Style/StringConcatenation - Style/SafeNavigation - Layout/MultilineMethodCallIndentation - Layout/EmptyLineAfterMagicComment - Layout/SpaceInsideHashLiteralBraces - Layout/EmptyLines - Layout/EmptyLineBetweenDefs --- Rakefile | 2 +- .../cop/github/insecure_hash_algorithm.rb | 31 +++++++------------ .../cop/github/rails_application_record.rb | 6 ++-- .../rails_controller_render_action_symbol.rb | 2 +- .../github/rails_controller_render_literal.rb | 14 +++------ .../rails_controller_render_paths_exist.rb | 14 +++------ .../rails_controller_render_shorthand.rb | 4 +-- lib/rubocop/cop/github/rails_render_inline.rb | 4 +-- .../github/rails_render_object_collection.rb | 4 +-- .../cop/github/rails_view_render_literal.rb | 10 ++---- .../github/rails_view_render_paths_exist.rb | 10 ++---- .../cop/github/render_literal_helpers.rb | 2 +- test/test_insecure_hash_algorithm.rb | 2 +- test/test_rails_controller_render_literal.rb | 1 - 14 files changed, 37 insertions(+), 69 deletions(-) diff --git a/Rakefile b/Rakefile index 25e3326..66dceb3 100644 --- a/Rakefile +++ b/Rakefile @@ -4,7 +4,7 @@ require "bundler/gem_tasks" require "rake/testtask" require "rubocop/rake_task" -task default: [:test, :rubocop] +task default: %i[test rubocop] Rake::TestTask.new RuboCop::RakeTask.new diff --git a/lib/rubocop/cop/github/insecure_hash_algorithm.rb b/lib/rubocop/cop/github/insecure_hash_algorithm.rb index de1b321..032bc12 100644 --- a/lib/rubocop/cop/github/insecure_hash_algorithm.rb +++ b/lib/rubocop/cop/github/insecure_hash_algorithm.rb @@ -64,6 +64,7 @@ class InsecureHashAlgorithm < Base def insecure_algorithm?(val) return false if val == :Digest # Don't match "Digest::Digest". + case alg_name(val) when *allowed_hash_functions false @@ -80,7 +81,7 @@ def not_just_encoding?(val) end def just_encoding?(val) - val == :hexencode || val == :bubblebabble + %i[hexencode bubblebabble].include?(val) end # Built-in hash functions are listed in these docs: @@ -99,6 +100,7 @@ def allowed_hash_functions def alg_name(val) return :nil if val.nil? return val.to_s.downcase unless val.is_a?(RuboCop::AST::Node) + case val.type when :sym, :str val.children.first.to_s.downcase @@ -108,28 +110,19 @@ def alg_name(val) end def on_const(const_node) - if insecure_const?(const_node) && !digest_uuid?(const_node) - add_offense(const_node, message: MSG) - end + add_offense(const_node, message: MSG) if insecure_const?(const_node) && !digest_uuid?(const_node) end def on_send(send_node) - case - when uuid_v3?(send_node) - unless allowed_hash_functions.include?("md5") - add_offense(send_node, message: UUID_V3_MSG) - end - when uuid_v5?(send_node) - unless allowed_hash_functions.include?("sha1") - add_offense(send_node, message: UUID_V5_MSG) - end - when openssl_hmac_new?(send_node) - if openssl_hmac_new_insecure?(send_node) - add_offense(send_node, message: MSG) - end - when insecure_digest?(send_node) + if uuid_v3?(send_node) + add_offense(send_node, message: UUID_V3_MSG) unless allowed_hash_functions.include?("md5") + elsif uuid_v5?(send_node) + add_offense(send_node, message: UUID_V5_MSG) unless allowed_hash_functions.include?("sha1") + elsif openssl_hmac_new?(send_node) + add_offense(send_node, message: MSG) if openssl_hmac_new_insecure?(send_node) + elsif insecure_digest?(send_node) add_offense(send_node, message: MSG) - when insecure_hash_lookup?(send_node) + elsif insecure_hash_lookup?(send_node) add_offense(send_node, message: MSG) end end diff --git a/lib/rubocop/cop/github/rails_application_record.rb b/lib/rubocop/cop/github/rails_application_record.rb index 1ec30cf..cfb1974 100644 --- a/lib/rubocop/cop/github/rails_application_record.rb +++ b/lib/rubocop/cop/github/rails_application_record.rb @@ -17,11 +17,9 @@ class RailsApplicationRecord < Base PATTERN def on_class(node) - klass, superclass, _ = *node + klass, superclass, = *node - if active_record_base_const?(superclass) && !(application_record_const?(klass)) - add_offense(superclass) - end + add_offense(superclass) if active_record_base_const?(superclass) && !application_record_const?(klass) end end end diff --git a/lib/rubocop/cop/github/rails_controller_render_action_symbol.rb b/lib/rubocop/cop/github/rails_controller_render_action_symbol.rb index e3d6eca..8661833 100644 --- a/lib/rubocop/cop/github/rails_controller_render_action_symbol.rb +++ b/lib/rubocop/cop/github/rails_controller_render_action_symbol.rb @@ -24,7 +24,7 @@ class RailsControllerRenderActionSymbol < Base def on_send(node) if sym_node = render_sym?(node) - add_offense(sym_node) do |corrector| + add_offense(sym_node) do |_corrector| register_offense(sym_node, node) end elsif option_pairs = render_with_options?(node) diff --git a/lib/rubocop/cop/github/rails_controller_render_literal.rb b/lib/rubocop/cop/github/rails_controller_render_literal.rb index 0f2efd3..edda84d 100644 --- a/lib/rubocop/cop/github/rails_controller_render_literal.rb +++ b/lib/rubocop/cop/github/rails_controller_render_literal.rb @@ -60,12 +60,10 @@ def on_send(node) elsif option_pairs = render_with_options?(node) option_pairs = option_pairs.reject { |pair| options_key?(pair) } - if option_pairs.any? { |pair| ignore_key?(pair) } - return - end + return if option_pairs.any? { |pair| ignore_key?(pair) } if template_node = option_pairs.map { |pair| template_key?(pair) }.compact.first - if !literal?(template_node) + unless literal?(template_node) add_offense(node) return end @@ -75,7 +73,7 @@ def on_send(node) end if layout_node = option_pairs.map { |pair| layout_key?(pair) }.compact.first - if !literal?(layout_node) + unless literal?(layout_node) add_offense(node) return end @@ -91,16 +89,14 @@ def on_send(node) add_offense(node) return end - option_pairs = option_hash && option_hash.pairs + option_pairs = option_hash&.pairs else option_pairs = node.arguments[0].pairs end if option_pairs locals = option_pairs.map { |pair| locals_key?(pair) }.compact.first - if locals && (!locals.hash_type? || !hash_with_literal_keys?(locals)) - add_offense(node) - end + add_offense(node) if locals && (!locals.hash_type? || !hash_with_literal_keys?(locals)) end end end diff --git a/lib/rubocop/cop/github/rails_controller_render_paths_exist.rb b/lib/rubocop/cop/github/rails_controller_render_paths_exist.rb index 126738a..3f84ce2 100644 --- a/lib/rubocop/cop/github/rails_controller_render_paths_exist.rb +++ b/lib/rubocop/cop/github/rails_controller_render_paths_exist.rb @@ -27,22 +27,16 @@ def on_send(node) if args = render_str?(node) node, path = args - unless resolve_template(path.to_s) - add_offense(node, message: "Template could not be found") - end + add_offense(node, message: "Template could not be found") unless resolve_template(path.to_s) elsif pairs = render_options?(node) if pair = pairs.detect { |p| render_key?(p) } key, node, path = render_key?(pair) case key when :action, :template - unless resolve_template(path.to_s) - add_offense(node, message: "Template could not be found") - end + add_offense(node, message: "Template could not be found") unless resolve_template(path.to_s) when :partial - unless resolve_partial(path.to_s) - add_offense(node, message: "Partial template could not be found") - end + add_offense(node, message: "Partial template could not be found") unless resolve_partial(path.to_s) end end end @@ -50,7 +44,7 @@ def on_send(node) def resolve_template(path) cop_config["ViewPath"].each do |view_path| - if m = Dir[File.join(config.path_relative_to_config(view_path), path) + "*"].first + if m = Dir["#{File.join(config.path_relative_to_config(view_path), path)}*"].first return m end end diff --git a/lib/rubocop/cop/github/rails_controller_render_shorthand.rb b/lib/rubocop/cop/github/rails_controller_render_shorthand.rb index 58069e1..ae62f71 100644 --- a/lib/rubocop/cop/github/rails_controller_render_shorthand.rb +++ b/lib/rubocop/cop/github/rails_controller_render_shorthand.rb @@ -28,8 +28,8 @@ def on_send(node) if value_node = action_key?(pair) comma = option_pairs.length > 1 ? ", " : "" corrected_source = node.source - .sub(/#{pair.source}(,\s*)?/, "") - .sub("render ", "render \"#{str(value_node)}\"#{comma}") + .sub(/#{pair.source}(,\s*)?/, "") + .sub("render ", "render \"#{str(value_node)}\"#{comma}") add_offense(node, message: "Use `#{corrected_source}` instead") do |corrector| corrector.replace(node.source_range, corrected_source) diff --git a/lib/rubocop/cop/github/rails_render_inline.rb b/lib/rubocop/cop/github/rails_render_inline.rb index 8f76fb2..65c8fb5 100644 --- a/lib/rubocop/cop/github/rails_render_inline.rb +++ b/lib/rubocop/cop/github/rails_render_inline.rb @@ -18,9 +18,7 @@ class RailsRenderInline < Base def on_send(node) if option_pairs = render_with_options?(node) - if option_pairs.detect { |pair| inline_key?(pair) } - add_offense(node) - end + add_offense(node) if option_pairs.detect { |pair| inline_key?(pair) } end end end diff --git a/lib/rubocop/cop/github/rails_render_object_collection.rb b/lib/rubocop/cop/github/rails_render_object_collection.rb index 38a27fa..b5a13b5 100644 --- a/lib/rubocop/cop/github/rails_render_object_collection.rb +++ b/lib/rubocop/cop/github/rails_render_object_collection.rb @@ -31,9 +31,7 @@ def on_send(node) case object_sym when :object - if partial_name.children[0].is_a?(String) - suggestion = ", instead `render partial: #{partial_name.source}, locals: { #{File.basename(partial_name.children[0], '.html.erb')}: #{object_node.source} }`" - end + suggestion = ", instead `render partial: #{partial_name.source}, locals: { #{File.basename(partial_name.children[0], '.html.erb')}: #{object_node.source} }`" if partial_name.children[0].is_a?(String) add_offense(node, message: "Avoid `render object:`#{suggestion}") when :collection, :spacer_template add_offense(node, message: "Avoid `render collection:`") diff --git a/lib/rubocop/cop/github/rails_view_render_literal.rb b/lib/rubocop/cop/github/rails_view_render_literal.rb index c856386..d3070d3 100644 --- a/lib/rubocop/cop/github/rails_view_render_literal.rb +++ b/lib/rubocop/cop/github/rails_view_render_literal.rb @@ -34,12 +34,10 @@ def on_send(node) if render_literal?(node) elsif option_pairs = render_with_options?(node) - if option_pairs.any? { |pair| ignore_key?(pair) } - return - end + return if option_pairs.any? { |pair| ignore_key?(pair) } if partial_node = option_pairs.map { |pair| partial_key?(pair) }.compact.first - if !literal?(partial_node) + unless literal?(partial_node) add_offense(node) return end @@ -60,9 +58,7 @@ def on_send(node) if locals if locals.hash_type? - if !hash_with_literal_keys?(locals) - add_offense(node) - end + add_offense(node) unless hash_with_literal_keys?(locals) else add_offense(node) end diff --git a/lib/rubocop/cop/github/rails_view_render_paths_exist.rb b/lib/rubocop/cop/github/rails_view_render_paths_exist.rb index 49a40f2..6423416 100644 --- a/lib/rubocop/cop/github/rails_view_render_paths_exist.rb +++ b/lib/rubocop/cop/github/rails_view_render_paths_exist.rb @@ -27,16 +27,12 @@ def on_send(node) if args = render_str?(node) node, path = args - unless resolve_partial(path.to_s) - add_offense(node, message: "Partial template could not be found") - end + add_offense(node, message: "Partial template could not be found") unless resolve_partial(path.to_s) elsif pairs = render_options?(node) if pair = pairs.detect { |p| partial_key?(p) } node, path = partial_key?(pair) - unless resolve_partial(path.to_s) - add_offense(node, message: "Partial template could not be found") - end + add_offense(node, message: "Partial template could not be found") unless resolve_partial(path.to_s) end end end @@ -47,7 +43,7 @@ def resolve_partial(path) path = parts.join(File::SEPARATOR) cop_config["ViewPath"].each do |view_path| - if m = Dir[File.join(config.path_relative_to_config(view_path), path) + "*"].first + if m = Dir["#{File.join(config.path_relative_to_config(view_path), path)}*"].first return m end end diff --git a/lib/rubocop/cop/github/render_literal_helpers.rb b/lib/rubocop/cop/github/render_literal_helpers.rb index 67417a5..6994fb7 100644 --- a/lib/rubocop/cop/github/render_literal_helpers.rb +++ b/lib/rubocop/cop/github/render_literal_helpers.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -# + require "rubocop" module RuboCop diff --git a/test/test_insecure_hash_algorithm.rb b/test/test_insecure_hash_algorithm.rb index 597450b..3e48aa9 100644 --- a/test/test_insecure_hash_algorithm.rb +++ b/test/test_insecure_hash_algorithm.rb @@ -10,7 +10,7 @@ def cop_class end def make_cop(allowed:) - config = RuboCop::Config.new({"GitHub/InsecureHashAlgorithm" => {"Allowed" => allowed}}) + config = RuboCop::Config.new({ "GitHub/InsecureHashAlgorithm" => { "Allowed" => allowed } }) cop_class.new(config) end diff --git a/test/test_rails_controller_render_literal.rb b/test/test_rails_controller_render_literal.rb index 9da2f16..bd52c7f 100644 --- a/test/test_rails_controller_render_literal.rb +++ b/test/test_rails_controller_render_literal.rb @@ -442,7 +442,6 @@ def index assert_equal 1, offenses.count end - def test_render_literal_dynamic_local_key_offense offenses = investigate cop, <<-RUBY, "app/controllers/products_controller.rb" class ProductsController < ActionController::Base From e36d683f6b85e7394775a02d9f6321f2cf34b4b5 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Mon, 10 Oct 2022 19:41:45 +0000 Subject: [PATCH 04/17] Fix `Naming/MemoizedInstanceVariableName` offenses --- lib/rubocop/cop/github/insecure_hash_algorithm.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rubocop/cop/github/insecure_hash_algorithm.rb b/lib/rubocop/cop/github/insecure_hash_algorithm.rb index 032bc12..e9fb330 100644 --- a/lib/rubocop/cop/github/insecure_hash_algorithm.rb +++ b/lib/rubocop/cop/github/insecure_hash_algorithm.rb @@ -94,7 +94,7 @@ def just_encoding?(val) ].freeze def allowed_hash_functions - @allowed_algorithms ||= cop_config.fetch("Allowed", DEFAULT_ALLOWED).map(&:downcase) + @allowed_hash_functions ||= cop_config.fetch("Allowed", DEFAULT_ALLOWED).map(&:downcase) end def alg_name(val) From ee3cac872c022eb36fdb603d0a0139c5e594f09f Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 11 Oct 2022 16:18:48 +0000 Subject: [PATCH 05/17] README: Note that `DisabledByDefault: true` is useful for granularity - Now that this behaviour has changed in `rubocop-github`, our users might want to have finer-grained control of which cops they enable since they can't rely on this gem to include that option now (if they even noticed). --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b5fb2ad..800d0b0 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ inherit_gem: 💭 Looking for `config/accessibility.yml` and the `GitHub/Accessibility` configs? They have been moved to [a new gem](https://github.com/github/rubocop-rails-accessibility). +For more granular control over which of RuboCop's rules are enabled for your project, both from this gem and your own configs, consider using the `DisabledByDefault: true` option under `AllCops` in your project's `.rubocop.yml` file. This will disable all cops by default, and you can then explicitly enable the ones you want by setting `Enabled: true`. See [the RuboCop docs](https://docs.rubocop.org/rubocop/configuration.html#enabled) for more information. + ### Legacy usage If you are using a rubocop version < 1.0.0, you can use rubocop-github version From db3b3380e26a90ba8f22194dd62861bcdfcef433 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 11 Oct 2022 16:26:19 +0000 Subject: [PATCH 06/17] CHANGELOG: Add an 'unreleased' section - Should probably write about the recent accessibility gem changes here, too, but that's not in this PR. Hence a generic 'unreleased' section. --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c42df4d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# rubocop-github + +## Unreleased + +- Unset `DisabledByDefault: true` in `config/default.yml`. This will use RuboCop's choice of default cops to enable, plus our existing augmentations in `config/default.yml`. Prevents confusing behaviour where downstream consumers didn't realise that RuboCop's default cops weren't being applied. (https://github.com/github/rubocop-github/pull/119) From f40758f26ce54c86bc4d7588383f7a514d3be7b4 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 11 Oct 2022 17:31:04 +0000 Subject: [PATCH 07/17] config/default: Explicitly set `Enabled: false` for a bunch of rules - These rules come directly from RuboCop. They're configured `Enabled: false` upstream, but it's worth being explicit in this gem since this guards against RuboCop changing underneath us and causing linting changes that either don't match our styleguide or we don't want to propagate to users of this gem. - This was generated by the following script (thanks to `@matthewd`), where `show-cops.yml` is the output of `bundle exec rubocop --show-cops`: ```ruby require "yaml" y = YAML.unsafe_load_file("show-cops.yml") cfg = YAML.unsafe_load_file(".rubocop.yml") off = y.keys.select { |k| y[k]["Enabled"] == false } (off - cfg.keys).sort.each { |k| puts "#{k}:\n Enabled: false\n\n" } ``` - Next I'll do the same for `Enabled: true`, then in a follow-up commit or PR (probably PR, at this point) I'll go through and link the `Enabled: true` ones to their styleguide items in the GitHub styleguide. --- config/default.yml | 147 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) diff --git a/config/default.yml b/config/default.yml index f04a02b..603e181 100644 --- a/config/default.yml +++ b/config/default.yml @@ -5,9 +5,18 @@ require: Bundler/DuplicatedGem: Enabled: true +Bundler/GemComment: + Enabled: false + +Bundler/GemVersion: + Enabled: false + Bundler/OrderedGems: Enabled: true +Gemspec/DependencyVersion: + Enabled: false + GitHub/InsecureHashAlgorithm: Enabled: true @@ -17,18 +26,39 @@ Layout/BlockAlignment: Layout/BlockEndNewline: Enabled: true +Layout/ClassStructure: + Enabled: false + Layout/ConditionPosition: Enabled: true Layout/DefEndAlignment: Enabled: true +Layout/EmptyLineAfterMultilineCondition: + Enabled: false + Layout/EndAlignment: Enabled: false Layout/EndOfLine: Enabled: true +Layout/FirstArrayElementLineBreak: + Enabled: false + +Layout/FirstHashElementLineBreak: + Enabled: false + +Layout/FirstMethodArgumentLineBreak: + Enabled: false + +Layout/FirstMethodParameterLineBreak: + Enabled: false + +Layout/HeredocArgumentClosingParenthesis: + Enabled: false + Layout/IndentationStyle: Enabled: true EnforcedStyle: spaces @@ -44,6 +74,24 @@ Layout/InitialIndentation: Layout/LineLength: Enabled: false +Layout/MultilineArrayLineBreaks: + Enabled: false + +Layout/MultilineAssignmentLayout: + Enabled: false + +Layout/MultilineHashKeyLineBreaks: + Enabled: false + +Layout/MultilineMethodArgumentLineBreaks: + Enabled: false + +Layout/RedundantLineBreak: + Enabled: false + +Layout/SingleLineBlockChain: + Enabled: false + Layout/SpaceAfterColon: Enabled: true @@ -96,6 +144,9 @@ Layout/TrailingWhitespace: Lint/CircularArgumentReference: Enabled: true +Lint/ConstantResolution: + Enabled: false + Lint/Debugger: Enabled: true @@ -132,6 +183,9 @@ Lint/FloatOutOfRange: Lint/FormatParameterMismatch: Enabled: true +Lint/HeredocMethodCallPosition: + Enabled: false + Lint/LiteralAsCondition: Enabled: true @@ -144,6 +198,9 @@ Lint/Loop: Lint/NextWithoutAccumulator: Enabled: true +Lint/NumberConversion: + Enabled: false + Lint/RandOne: Enabled: true @@ -213,12 +270,21 @@ Naming/ClassAndModuleCamelCase: Naming/FileName: Enabled: true +Naming/InclusiveLanguage: + Enabled: false + Naming/MethodName: Enabled: true +Performance/ArraySemiInfiniteRangeSlice: + Enabled: false + Performance/CaseWhenSplat: Enabled: false +Performance/ChainArrayAllocation: + Enabled: false + Performance/Count: Enabled: true @@ -234,6 +300,9 @@ Performance/EndWith: Performance/FlatMap: Enabled: true +Performance/OpenStruct: + Enabled: false + Performance/RangeInclude: Enabled: false @@ -247,6 +316,9 @@ Performance/RedundantMerge: Performance/ReverseEach: Enabled: true +Performance/SelectMap: + Enabled: false + Performance/Size: Enabled: true @@ -256,9 +328,18 @@ Performance/StartWith: Security/Eval: Enabled: true +Style/ArrayCoercion: + Enabled: false + Style/ArrayJoin: Enabled: true +Style/AsciiComments: + Enabled: false + +Style/AutoResourceCleanup: + Enabled: false + Style/BeginBlock: Enabled: true @@ -274,12 +355,33 @@ Style/CharacterLiteral: Style/ClassMethods: Enabled: true +Style/ClassMethodsDefinitions: + Enabled: false + +Style/CollectionMethods: + Enabled: false + +Style/ConstantVisibility: + Enabled: false + Style/Copyright: Enabled: false +Style/DateTime: + Enabled: false + Style/DefWithParentheses: Enabled: true +Style/DisableCopsWithinSourceCodeDirective: + Enabled: false + +Style/Documentation: + Enabled: false + +Style/DocumentationMethod: + Enabled: false + Style/EndBlock: Enabled: true @@ -289,6 +391,15 @@ Style/For: Style/FrozenStringLiteralComment: Enabled: true +Style/ImplicitRuntimeError: + Enabled: false + +Style/InlineComment: + Enabled: false + +Style/IpAddresses: + Enabled: false + Style/HashSyntax: Enabled: true EnforcedStyle: ruby19_no_mixed_keys @@ -296,15 +407,24 @@ Style/HashSyntax: Style/LambdaCall: Enabled: true +Style/MethodCalledOnDoEndBlock: + Enabled: false + Style/MethodCallWithoutArgsParentheses: Enabled: true Style/MethodDefParentheses: Enabled: true +Style/MissingElse: + Enabled: false + Style/MultilineIfThen: Enabled: true +Style/MultilineMethodSignature: + Enabled: false + Style/NilComparison: Enabled: true @@ -314,18 +434,45 @@ Style/Not: Style/OneLineConditional: Enabled: true +Style/OptionHash: + Enabled: false + Style/RedundantSortBy: Enabled: true +Style/ReturnNil: + Enabled: false + Style/Sample: Enabled: true +Style/SingleLineBlockParams: + Enabled: false + Style/StabbyLambdaParentheses: Enabled: true +Style/StaticClass: + Enabled: false + Style/Strip: Enabled: true +Style/StringHashKeys: + Enabled: false + Style/StringLiterals: Enabled: true EnforcedStyle: double_quotes + +Style/StringMethods: + Enabled: false + +Style/TopLevelMethodDefinition: + Enabled: false + +Style/TrailingCommaInBlockArgs: + Enabled: false + +Style/UnlessLogicalOperators: + Enabled: false From 05e82768e5bff3380276d5b2cb7d59a85ddfd6ca Mon Sep 17 00:00:00 2001 From: Issy Long Date: Tue, 11 Oct 2022 17:44:17 +0000 Subject: [PATCH 08/17] config/default: Add `Enabled: true` cops now configured by default - Previously these were disabled because of `DisableByDefault: true`. Since we removed that config, all of these become enabled. That's somewhat undesirable since when we ship the new version, downstream consumers of this gem will have to make decisions to enable or disable the cops. We should do this for them and make this gem the source of truth matching the styleguide as far as possible. Of course, downstream projects are free to tweak in their own `.rubocop.yml` for what matches their project style, but we should attempt to set a central standard according to the styleguide that we publish, to make writing Ruby at GitHub easier. - I left some TODOs to audit these (before we ship the new gem version!) for whether or not they: - a) already exist in the file in either enabled/disabled state; - b) checking if the GitHub Ruby styleguide has opinions on them and enabling/disabling accordingly. - This list was (as in the previous commit) generated by: ```ruby require "yaml" y = YAML.unsafe_load_file("show-cops.yml") cfg = YAML.unsafe_load_file(".rubocop.yml") on = y.keys.select { |k| y[k]["Enabled"] == true } (on - cfg.keys).sort.each { |k| puts "#{k}:\n Enabled: true\n\n" } ``` --- config/default.yml | 1230 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1230 insertions(+) diff --git a/config/default.yml b/config/default.yml index 603e181..8cc171b 100644 --- a/config/default.yml +++ b/config/default.yml @@ -476,3 +476,1233 @@ Style/TrailingCommaInBlockArgs: Style/UnlessLogicalOperators: Enabled: false + +# TODO: Check if the following cops are in the GitHub Ruby styleguide; disable them if not. +# TODO: Add `StyleGuide` links for cops that are in the GitHub Ruby styleguide. +# TODO: It would be good to run an alphabetization script over these, to put them +# in the right places in this file. Also there are probably duplicates for rules +# that we already had enabled/disabled previously. + +Bundler/DuplicatedGem: + Enabled: true + +Bundler/GemFilename: + Enabled: true + +Bundler/InsecureProtocolSource: + Enabled: true + +Bundler/OrderedGems: + Enabled: true + +Gemspec/DuplicatedAssignment: + Enabled: true + +Gemspec/OrderedDependencies: + Enabled: true + +Gemspec/RubyVersionGlobalsUsage: + Enabled: true + +GitHub/InsecureHashAlgorithm: + Enabled: true + +GitHub/RailsApplicationRecord: + Enabled: true + +GitHub/RailsControllerRenderActionSymbol: + Enabled: true + +GitHub/RailsControllerRenderLiteral: + Enabled: true + +GitHub/RailsControllerRenderPathsExist: + Enabled: true + +GitHub/RailsControllerRenderShorthand: + Enabled: true + +GitHub/RailsRenderInline: + Enabled: true + +GitHub/RailsRenderObjectCollection: + Enabled: true + +GitHub/RailsViewRenderLiteral: + Enabled: true + +GitHub/RailsViewRenderPathsExist: + Enabled: true + +GitHub/RailsViewRenderShorthand: + Enabled: true + +Layout/AccessModifierIndentation: + Enabled: true + +Layout/ArgumentAlignment: + Enabled: true + +Layout/ArrayAlignment: + Enabled: true + +Layout/AssignmentIndentation: + Enabled: true + +Layout/BeginEndAlignment: + Enabled: true + +Layout/BlockAlignment: + Enabled: true + +Layout/BlockEndNewline: + Enabled: true + +Layout/CaseIndentation: + Enabled: true + +Layout/ClosingHeredocIndentation: + Enabled: true + +Layout/ClosingParenthesisIndentation: + Enabled: true + +Layout/CommentIndentation: + Enabled: true + +Layout/ConditionPosition: + Enabled: true + +Layout/DefEndAlignment: + Enabled: true + +Layout/DotPosition: + Enabled: true + +Layout/ElseAlignment: + Enabled: true + +Layout/EmptyComment: + Enabled: true + +Layout/EmptyLineAfterGuardClause: + Enabled: true + +Layout/EmptyLineAfterMagicComment: + Enabled: true + +Layout/EmptyLineBetweenDefs: + Enabled: true + +Layout/EmptyLines: + Enabled: true + +Layout/EmptyLinesAroundAccessModifier: + Enabled: true + +Layout/EmptyLinesAroundArguments: + Enabled: true + +Layout/EmptyLinesAroundAttributeAccessor: + Enabled: true + +Layout/EmptyLinesAroundBeginBody: + Enabled: true + +Layout/EmptyLinesAroundBlockBody: + Enabled: true + +Layout/EmptyLinesAroundClassBody: + Enabled: true + +Layout/EmptyLinesAroundExceptionHandlingKeywords: + Enabled: true + +Layout/EmptyLinesAroundMethodBody: + Enabled: true + +Layout/EmptyLinesAroundModuleBody: + Enabled: true + +Layout/EndOfLine: + Enabled: true + +Layout/ExtraSpacing: + Enabled: true + +Layout/FirstArgumentIndentation: + Enabled: true + +Layout/FirstArrayElementIndentation: + Enabled: true + +Layout/FirstHashElementIndentation: + Enabled: true + +Layout/FirstParameterIndentation: + Enabled: true + +Layout/HashAlignment: + Enabled: true + +Layout/HeredocIndentation: + Enabled: true + +Layout/IndentationConsistency: + Enabled: true + +Layout/IndentationStyle: + Enabled: true + +Layout/IndentationWidth: + Enabled: true + +Layout/InitialIndentation: + Enabled: true + +Layout/LeadingCommentSpace: + Enabled: true + +Layout/LeadingEmptyLines: + Enabled: true + +Layout/MultilineArrayBraceLayout: + Enabled: true + +Layout/MultilineBlockLayout: + Enabled: true + +Layout/MultilineHashBraceLayout: + Enabled: true + +Layout/MultilineMethodCallBraceLayout: + Enabled: true + +Layout/MultilineMethodCallIndentation: + Enabled: true + +Layout/MultilineMethodDefinitionBraceLayout: + Enabled: true + +Layout/MultilineOperationIndentation: + Enabled: true + +Layout/ParameterAlignment: + Enabled: true + +Layout/RescueEnsureAlignment: + Enabled: true + +Layout/SpaceAfterColon: + Enabled: true + +Layout/SpaceAfterComma: + Enabled: true + +Layout/SpaceAfterMethodName: + Enabled: true + +Layout/SpaceAfterNot: + Enabled: true + +Layout/SpaceAfterSemicolon: + Enabled: true + +Layout/SpaceAroundBlockParameters: + Enabled: true + +Layout/SpaceAroundEqualsInParameterDefault: + Enabled: true + +Layout/SpaceAroundKeyword: + Enabled: true + +Layout/SpaceAroundMethodCallOperator: + Enabled: true + +Layout/SpaceAroundOperators: + Enabled: true + +Layout/SpaceBeforeBlockBraces: + Enabled: true + +Layout/SpaceBeforeComma: + Enabled: true + +Layout/SpaceBeforeComment: + Enabled: true + +Layout/SpaceBeforeFirstArg: + Enabled: true + +Layout/SpaceBeforeSemicolon: + Enabled: true + +Layout/SpaceInLambdaLiteral: + Enabled: true + +Layout/SpaceInsideArrayLiteralBrackets: + Enabled: true + +Layout/SpaceInsideArrayPercentLiteral: + Enabled: true + +Layout/SpaceInsideBlockBraces: + Enabled: true + +Layout/SpaceInsideHashLiteralBraces: + Enabled: true + +Layout/SpaceInsideParens: + Enabled: true + +Layout/SpaceInsidePercentLiteralDelimiters: + Enabled: true + +Layout/SpaceInsideRangeLiteral: + Enabled: true + +Layout/SpaceInsideReferenceBrackets: + Enabled: true + +Layout/SpaceInsideStringInterpolation: + Enabled: true + +Layout/TrailingEmptyLines: + Enabled: true + +Layout/TrailingWhitespace: + Enabled: true + +Lint/AmbiguousBlockAssociation: + Enabled: true + +Lint/AmbiguousOperator: + Enabled: true + +Lint/AmbiguousRegexpLiteral: + Enabled: true + +Lint/BigDecimalNew: + Enabled: true + +Lint/BinaryOperatorWithIdenticalOperands: + Enabled: true + +Lint/BooleanSymbol: + Enabled: true + +Lint/CircularArgumentReference: + Enabled: true + +Lint/ConstantDefinitionInBlock: + Enabled: true + +Lint/Debugger: + Enabled: true + +Lint/DeprecatedClassMethods: + Enabled: true + +Lint/DeprecatedOpenSSLConstant: + Enabled: true + +Lint/DisjunctiveAssignmentInConstructor: + Enabled: true + +Lint/DuplicateCaseCondition: + Enabled: true + +Lint/DuplicateElsifCondition: + Enabled: true + +Lint/DuplicateHashKey: + Enabled: true + +Lint/DuplicateMethods: + Enabled: true + +Lint/DuplicateRequire: + Enabled: true + +Lint/DuplicateRescueException: + Enabled: true + +Lint/EachWithObjectArgument: + Enabled: true + +Lint/ElseLayout: + Enabled: true + +Lint/EmptyEnsure: + Enabled: true + +Lint/EmptyExpression: + Enabled: true + +Lint/EmptyFile: + Enabled: true + +Lint/EmptyInterpolation: + Enabled: true + +Lint/EmptyWhen: + Enabled: true + +Lint/EnsureReturn: + Enabled: true + +Lint/ErbNewArguments: + Enabled: true + +Lint/FlipFlop: + Enabled: true + +Lint/FloatComparison: + Enabled: true + +Lint/FloatOutOfRange: + Enabled: true + +Lint/FormatParameterMismatch: + Enabled: true + +Lint/HashCompareByIdentity: + Enabled: true + +Lint/IdentityComparison: + Enabled: true + +Lint/ImplicitStringConcatenation: + Enabled: true + +Lint/IneffectiveAccessModifier: + Enabled: true + +Lint/InheritException: + Enabled: true + +Lint/InterpolationCheck: + Enabled: true + +Lint/LiteralAsCondition: + Enabled: true + +Lint/LiteralInInterpolation: + Enabled: true + +Lint/Loop: + Enabled: true + +Lint/MissingCopEnableDirective: + Enabled: true + +Lint/MissingSuper: + Enabled: true + +Lint/MixedRegexpCaptureTypes: + Enabled: true + +Lint/MultipleComparison: + Enabled: true + +Lint/NestedMethodDefinition: + Enabled: true + +Lint/NestedPercentLiteral: + Enabled: true + +Lint/NextWithoutAccumulator: + Enabled: true + +Lint/NonDeterministicRequireOrder: + Enabled: true + +Lint/NonLocalExitFromIterator: + Enabled: true + +Lint/OrderedMagicComments: + Enabled: true + +Lint/OutOfRangeRegexpRef: + Enabled: true + +Lint/ParenthesesAsGroupedExpression: + Enabled: true + +Lint/PercentStringArray: + Enabled: true + +Lint/PercentSymbolArray: + Enabled: true + +Lint/RaiseException: + Enabled: true + +Lint/RandOne: + Enabled: true + +Lint/RedundantCopDisableDirective: + Enabled: true + +Lint/RedundantCopEnableDirective: + Enabled: true + +Lint/RedundantRequireStatement: + Enabled: true + +Lint/RedundantSafeNavigation: + Enabled: true + +Lint/RedundantSplatExpansion: + Enabled: true + +Lint/RedundantStringCoercion: + Enabled: true + +Lint/RedundantWithIndex: + Enabled: true + +Lint/RedundantWithObject: + Enabled: true + +Lint/RegexpAsCondition: + Enabled: true + +Lint/RequireParentheses: + Enabled: true + +Lint/RescueException: + Enabled: true + +Lint/RescueType: + Enabled: true + +Lint/ReturnInVoidContext: + Enabled: true + +Lint/SafeNavigationChain: + Enabled: true + +Lint/SafeNavigationConsistency: + Enabled: true + +Lint/SafeNavigationWithEmpty: + Enabled: true + +Lint/ScriptPermission: + Enabled: true + +Lint/SelfAssignment: + Enabled: true + +Lint/SendWithMixinArgument: + Enabled: true + +Lint/ShadowedArgument: + Enabled: true + +Lint/ShadowedException: + Enabled: true + +Lint/ShadowingOuterLocalVariable: + Enabled: true + +Lint/StructNewOverride: + Enabled: true + +Lint/SuppressedException: + Enabled: true + +Lint/Syntax: + Enabled: true + +Lint/ToJSON: + Enabled: true + +Lint/TopLevelReturnWithArgument: + Enabled: true + +Lint/TrailingCommaInAttributeDeclaration: + Enabled: true + +Lint/UnderscorePrefixedVariableName: + Enabled: true + +Lint/UnifiedInteger: + Enabled: true + +Lint/UnreachableCode: + Enabled: true + +Lint/UnreachableLoop: + Enabled: true + +Lint/UnusedBlockArgument: + Enabled: true + +Lint/UnusedMethodArgument: + Enabled: true + +Lint/UriEscapeUnescape: + Enabled: true + +Lint/UriRegexp: + Enabled: true + +Lint/UselessAccessModifier: + Enabled: true + +Lint/UselessElseWithoutRescue: + Enabled: true + +Lint/UselessMethodDefinition: + Enabled: true + +Lint/UselessSetterCall: + Enabled: true + +Lint/UselessTimes: + Enabled: true + +Lint/Void: + Enabled: true + +Migration/DepartmentName: + Enabled: true + +Naming/AccessorMethodName: + Enabled: true + +Naming/AsciiIdentifiers: + Enabled: true + +Naming/BinaryOperatorParameterName: + Enabled: true + +Naming/BlockParameterName: + Enabled: true + +Naming/ClassAndModuleCamelCase: + Enabled: true + +Naming/ConstantName: + Enabled: true + +Naming/HeredocDelimiterCase: + Enabled: true + +Naming/HeredocDelimiterNaming: + Enabled: true + +Naming/MemoizedInstanceVariableName: + Enabled: true + +Naming/MethodName: + Enabled: true + +Naming/MethodParameterName: + Enabled: true + +Naming/PredicateName: + Enabled: true + +Naming/RescuedExceptionsVariableName: + Enabled: true + +Naming/VariableName: + Enabled: true + +Naming/VariableNumber: + Enabled: true + +Performance/BindCall: + Enabled: true + +Performance/Caller: + Enabled: true + +Performance/Casecmp: + Enabled: true + +Performance/CompareWithBlock: + Enabled: true + +Performance/Count: + Enabled: true + +Performance/DeletePrefix: + Enabled: true + +Performance/DeleteSuffix: + Enabled: true + +Performance/Detect: + Enabled: true + +Performance/DoubleStartEndWith: + Enabled: true + +Performance/EndWith: + Enabled: true + +Performance/FixedSize: + Enabled: true + +Performance/FlatMap: + Enabled: true + +Performance/InefficientHashSearch: + Enabled: true + +Performance/RedundantBlockCall: + Enabled: true + +Performance/RedundantMerge: + Enabled: true + +Performance/RegexpMatch: + Enabled: true + +Performance/ReverseEach: + Enabled: true + +Performance/Size: + Enabled: true + +Performance/StartWith: + Enabled: true + +Performance/StringReplacement: + Enabled: true + +Performance/TimesMap: + Enabled: true + +Performance/UnfreezeString: + Enabled: true + +Performance/UriDefaultParser: + Enabled: true + +Security/Eval: + Enabled: true + +Security/JSONLoad: + Enabled: true + +Security/MarshalLoad: + Enabled: true + +Security/Open: + Enabled: true + +Security/YAMLLoad: + Enabled: true + +Style/AccessModifierDeclarations: + Enabled: true + +Style/AccessorGrouping: + Enabled: true + +Style/Alias: + Enabled: true + +Style/AndOr: + Enabled: true + +Style/ArrayJoin: + Enabled: true + +Style/Attr: + Enabled: true + +Style/BarePercentLiterals: + Enabled: true + +Style/BeginBlock: + Enabled: true + +Style/BisectedAttrAccessor: + Enabled: true + +Style/BlockComments: + Enabled: true + +Style/BlockDelimiters: + Enabled: true + +Style/CaseEquality: + Enabled: true + +Style/CaseLikeIf: + Enabled: true + +Style/CharacterLiteral: + Enabled: true + +Style/ClassAndModuleChildren: + Enabled: true + +Style/ClassCheck: + Enabled: true + +Style/ClassEqualityComparison: + Enabled: true + +Style/ClassMethods: + Enabled: true + +Style/ClassVars: + Enabled: true + +Style/ColonMethodCall: + Enabled: true + +Style/ColonMethodDefinition: + Enabled: true + +Style/CombinableLoops: + Enabled: true + +Style/CommandLiteral: + Enabled: true + +Style/CommentAnnotation: + Enabled: true + +Style/CommentedKeyword: + Enabled: true + +Style/ConditionalAssignment: + Enabled: true + +Style/DefWithParentheses: + Enabled: true + +Style/Dir: + Enabled: true + +Style/DoubleCopDisableDirective: + Enabled: true + +Style/DoubleNegation: + Enabled: true + +Style/EachForSimpleLoop: + Enabled: true + +Style/EachWithObject: + Enabled: true + +Style/EmptyBlockParameter: + Enabled: true + +Style/EmptyCaseCondition: + Enabled: true + +Style/EmptyElse: + Enabled: true + +Style/EmptyLambdaParameter: + Enabled: true + +Style/EmptyLiteral: + Enabled: true + +Style/EmptyMethod: + Enabled: true + +Style/Encoding: + Enabled: true + +Style/EndBlock: + Enabled: true + +Style/EvalWithLocation: + Enabled: true + +Style/EvenOdd: + Enabled: true + +Style/ExpandPathArguments: + Enabled: true + +Style/ExplicitBlockArgument: + Enabled: true + +Style/ExponentialNotation: + Enabled: true + +Style/FloatDivision: + Enabled: true + +Style/For: + Enabled: true + +Style/FormatString: + Enabled: true + +Style/FormatStringToken: + Enabled: true + +Style/FrozenStringLiteralComment: + Enabled: true + +Style/GlobalStdStream: + Enabled: true + +Style/GlobalVars: + Enabled: true + +Style/HashAsLastArrayItem: + Enabled: true + +Style/HashEachMethods: + Enabled: true + +Style/HashLikeCase: + Enabled: true + +Style/HashSyntax: + Enabled: true + +Style/HashTransformKeys: + Enabled: true + +Style/HashTransformValues: + Enabled: true + +Style/IdenticalConditionalBranches: + Enabled: true + +Style/IfInsideElse: + Enabled: true + +Style/IfUnlessModifier: + Enabled: true + +Style/IfUnlessModifierOfIfUnless: + Enabled: true + +Style/IfWithSemicolon: + Enabled: true + +Style/InfiniteLoop: + Enabled: true + +Style/InverseMethods: + Enabled: true + +Style/KeywordParametersOrder: + Enabled: true + +Style/Lambda: + Enabled: true + +Style/LambdaCall: + Enabled: true + +Style/LineEndConcatenation: + Enabled: true + +Style/MethodCallWithoutArgsParentheses: + Enabled: true + +Style/MethodDefParentheses: + Enabled: true + +Style/MinMax: + Enabled: true + +Style/MissingRespondToMissing: + Enabled: true + +Style/MixinGrouping: + Enabled: true + +Style/MixinUsage: + Enabled: true + +Style/ModuleFunction: + Enabled: true + +Style/MultilineBlockChain: + Enabled: true + +Style/MultilineIfModifier: + Enabled: true + +Style/MultilineIfThen: + Enabled: true + +Style/MultilineMemoization: + Enabled: true + +Style/MultilineTernaryOperator: + Enabled: true + +Style/MultilineWhenThen: + Enabled: true + +Style/MultipleComparison: + Enabled: true + +Style/MutableConstant: + Enabled: true + +Style/NegatedIf: + Enabled: true + +Style/NegatedUnless: + Enabled: true + +Style/NegatedWhile: + Enabled: true + +Style/NestedModifier: + Enabled: true + +Style/NestedParenthesizedCalls: + Enabled: true + +Style/NestedTernaryOperator: + Enabled: true + +Style/NilComparison: + Enabled: true + +Style/NonNilCheck: + Enabled: true + +Style/Not: + Enabled: true + +Style/NumericLiteralPrefix: + Enabled: true + +Style/NumericLiterals: + Enabled: true + +Style/NumericPredicate: + Enabled: true + +Style/OneLineConditional: + Enabled: true + +Style/OptionalArguments: + Enabled: true + +Style/OptionalBooleanParameter: + Enabled: true + +Style/OrAssignment: + Enabled: true + +Style/ParallelAssignment: + Enabled: true + +Style/ParenthesesAroundCondition: + Enabled: true + +Style/PercentLiteralDelimiters: + Enabled: true + +Style/PercentQLiterals: + Enabled: true + +Style/PerlBackrefs: + Enabled: true + +Style/PreferredHashMethods: + Enabled: true + +Style/Proc: + Enabled: true + +Style/RaiseArgs: + Enabled: true + +Style/RandomWithOffset: + Enabled: true + +Style/RedundantAssignment: + Enabled: true + +Style/RedundantBegin: + Enabled: true + +Style/RedundantCapitalW: + Enabled: true + +Style/RedundantCondition: + Enabled: true + +Style/RedundantConditional: + Enabled: true + +Style/RedundantException: + Enabled: true + +Style/RedundantFetchBlock: + Enabled: true + +Style/RedundantFileExtensionInRequire: + Enabled: true + +Style/RedundantFreeze: + Enabled: true + +Style/RedundantInterpolation: + Enabled: true + +Style/RedundantParentheses: + Enabled: true + +Style/RedundantPercentQ: + Enabled: true + +Style/RedundantRegexpCharacterClass: + Enabled: true + +Style/RedundantRegexpEscape: + Enabled: true + +Style/RedundantReturn: + Enabled: true + +Style/RedundantSelf: + Enabled: true + +Style/RedundantSelfAssignment: + Enabled: true + +Style/RedundantSort: + Enabled: true + +Style/RedundantSortBy: + Enabled: true + +Style/RegexpLiteral: + Enabled: true + +Style/RescueModifier: + Enabled: true + +Style/RescueStandardError: + Enabled: true + +Style/SafeNavigation: + Enabled: true + +Style/Sample: + Enabled: true + +Style/SelfAssignment: + Enabled: true + +Style/Semicolon: + Enabled: true + +Style/SignalException: + Enabled: true + +Style/SingleArgumentDig: + Enabled: true + +Style/SingleLineMethods: + Enabled: true + +Style/SlicingWithRange: + Enabled: true + +Style/SpecialGlobalVars: + Enabled: true + +Style/StabbyLambdaParentheses: + Enabled: true + +Style/StderrPuts: + Enabled: true + +Style/StringConcatenation: + Enabled: true + +Style/StringLiterals: + Enabled: true + +Style/StringLiteralsInInterpolation: + Enabled: true + +Style/Strip: + Enabled: true + +Style/StructInheritance: + Enabled: true + +Style/SymbolArray: + Enabled: true + +Style/SymbolLiteral: + Enabled: true + +Style/SymbolProc: + Enabled: true + +Style/TernaryParentheses: + Enabled: true + +Style/TrailingBodyOnClass: + Enabled: true + +Style/TrailingBodyOnMethodDefinition: + Enabled: true + +Style/TrailingBodyOnModule: + Enabled: true + +Style/TrailingCommaInArguments: + Enabled: true + +Style/TrailingCommaInArrayLiteral: + Enabled: true + +Style/TrailingCommaInHashLiteral: + Enabled: true + +Style/TrailingMethodEndStatement: + Enabled: true + +Style/TrailingUnderscoreVariable: + Enabled: true + +Style/TrivialAccessors: + Enabled: true + +Style/UnlessElse: + Enabled: true + +Style/UnpackFirst: + Enabled: true + +Style/VariableInterpolation: + Enabled: true + +Style/WhenThen: + Enabled: true + +Style/WhileUntilDo: + Enabled: true + +Style/WhileUntilModifier: + Enabled: true + +Style/WordArray: + Enabled: true + +Style/YodaCondition: + Enabled: true + +Style/ZeroLengthPredicate: + Enabled: true From e48f4521aed8730da99e85c9de56c7780d3f33e9 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 12 Oct 2022 09:59:30 +0000 Subject: [PATCH 09/17] config/default: Set `Enabled: false` on a bunch of rules - This enumerates all of the currently defined rules that were implicitly disabled by `DisabledByDefault: true` and make them explicitly disabled so that there is no functional change to the RuboCop cops today e.g. if someone upgrades they won't experience a flood of newly enabled rules. - This was achieved by briefly re-enabling `DisabledByDefault`, then running `bundle exec rubocop --show-cops`, and the script included with the previous commit. - All of the TODOs from the previous commit about cross-checking newly enabled rules with the styleguide are gone, since there are no newly enabled rules, and this should be a better user experience for downstream consumers since they don't have to scramble to understand new RuboCop rules that fail in their project (over and above custom ones they have in their project which will now be enabled because we removed `DisabledByDefault` in this gem). - In the future, we'll go through the list of rules here and cross-check them with the styleguide, potentially migrating some of them to `Enabled: true`. But this changeset as it is now should be good to ship. --- config/default.yml | 1554 +++++++++++++++++++++----------------------- 1 file changed, 738 insertions(+), 816 deletions(-) diff --git a/config/default.yml b/config/default.yml index 8cc171b..c34453d 100644 --- a/config/default.yml +++ b/config/default.yml @@ -8,549 +8,53 @@ Bundler/DuplicatedGem: Bundler/GemComment: Enabled: false -Bundler/GemVersion: - Enabled: false - -Bundler/OrderedGems: - Enabled: true - -Gemspec/DependencyVersion: - Enabled: false - -GitHub/InsecureHashAlgorithm: - Enabled: true - -Layout/BlockAlignment: - Enabled: true - -Layout/BlockEndNewline: - Enabled: true - -Layout/ClassStructure: - Enabled: false - -Layout/ConditionPosition: - Enabled: true - -Layout/DefEndAlignment: - Enabled: true - -Layout/EmptyLineAfterMultilineCondition: - Enabled: false - -Layout/EndAlignment: - Enabled: false - -Layout/EndOfLine: - Enabled: true - -Layout/FirstArrayElementLineBreak: - Enabled: false - -Layout/FirstHashElementLineBreak: - Enabled: false - -Layout/FirstMethodArgumentLineBreak: - Enabled: false - -Layout/FirstMethodParameterLineBreak: - Enabled: false - -Layout/HeredocArgumentClosingParenthesis: - Enabled: false - -Layout/IndentationStyle: - Enabled: true - EnforcedStyle: spaces - IndentationWidth: 2 - -Layout/IndentationWidth: - Enabled: true - Width: 2 - -Layout/InitialIndentation: - Enabled: true - -Layout/LineLength: - Enabled: false - -Layout/MultilineArrayLineBreaks: - Enabled: false - -Layout/MultilineAssignmentLayout: - Enabled: false - -Layout/MultilineHashKeyLineBreaks: - Enabled: false - -Layout/MultilineMethodArgumentLineBreaks: - Enabled: false - -Layout/RedundantLineBreak: - Enabled: false - -Layout/SingleLineBlockChain: - Enabled: false - -Layout/SpaceAfterColon: - Enabled: true - -Layout/SpaceAfterComma: - Enabled: true - -Layout/SpaceAfterMethodName: - Enabled: true - -Layout/SpaceAfterNot: - Enabled: true - -Layout/SpaceAfterSemicolon: - Enabled: true - -Layout/SpaceAroundBlockParameters: - Enabled: true - -Layout/SpaceAroundEqualsInParameterDefault: - Enabled: true - -Layout/SpaceBeforeBlockBraces: - Enabled: true - -Layout/SpaceInsideArrayLiteralBrackets: - Enabled: true - EnforcedStyle: no_space - -Layout/SpaceInsideArrayPercentLiteral: - Enabled: true - -Layout/SpaceInsideBlockBraces: - Enabled: true - -Layout/SpaceInsideParens: - Enabled: true - -Layout/SpaceInsideRangeLiteral: - Enabled: true - -Layout/SpaceInsideReferenceBrackets: - Enabled: true - -Layout/TrailingEmptyLines: - Enabled: true - -Layout/TrailingWhitespace: - Enabled: true - -Lint/CircularArgumentReference: - Enabled: true - -Lint/ConstantResolution: - Enabled: false - -Lint/Debugger: - Enabled: true - -Lint/DeprecatedClassMethods: - Enabled: true - -Lint/DuplicateMethods: - Enabled: true - -Lint/DuplicateHashKey: - Enabled: true - -Lint/EachWithObjectArgument: - Enabled: true - -Lint/ElseLayout: - Enabled: true - -Lint/EmptyEnsure: - Enabled: true - -Lint/EmptyInterpolation: - Enabled: true - -Lint/EnsureReturn: - Enabled: true - -Lint/FlipFlop: - Enabled: true - -Lint/FloatOutOfRange: - Enabled: true - -Lint/FormatParameterMismatch: - Enabled: true - -Lint/HeredocMethodCallPosition: - Enabled: false - -Lint/LiteralAsCondition: - Enabled: true - -Lint/LiteralInInterpolation: - Enabled: true - -Lint/Loop: - Enabled: true - -Lint/NextWithoutAccumulator: - Enabled: true - -Lint/NumberConversion: - Enabled: false - -Lint/RandOne: - Enabled: true - -Lint/RequireParentheses: - Enabled: true - -Lint/RescueException: - Enabled: true - -Lint/RedundantStringCoercion: - Enabled: true - -Lint/UnderscorePrefixedVariableName: - Enabled: true - -Lint/RedundantCopDisableDirective: - Enabled: true - -Lint/RedundantSplatExpansion: - Enabled: true - -Lint/UnreachableCode: - Enabled: true - -Lint/BinaryOperatorWithIdenticalOperands: - Enabled: true - -Lint/UselessSetterCall: - Enabled: true - -Lint/Void: - Enabled: true - -Metrics/AbcSize: - Enabled: false - -Metrics/BlockLength: - Enabled: false - -Metrics/BlockNesting: - Enabled: false - -Metrics/ClassLength: - Enabled: false - -Metrics/CyclomaticComplexity: - Enabled: false - -Metrics/MethodLength: - Enabled: false - -Metrics/ModuleLength: - Enabled: false - -Metrics/ParameterLists: - Enabled: false - -Metrics/PerceivedComplexity: - Enabled: false - -Naming/AsciiIdentifiers: - Enabled: true - -Naming/ClassAndModuleCamelCase: - Enabled: true - -Naming/FileName: - Enabled: true - -Naming/InclusiveLanguage: - Enabled: false - -Naming/MethodName: - Enabled: true - -Performance/ArraySemiInfiniteRangeSlice: - Enabled: false - -Performance/CaseWhenSplat: - Enabled: false - -Performance/ChainArrayAllocation: - Enabled: false - -Performance/Count: - Enabled: true - -Performance/Detect: - Enabled: true - -Performance/DoubleStartEndWith: - Enabled: true - -Performance/EndWith: - Enabled: true - -Performance/FlatMap: - Enabled: true - -Performance/OpenStruct: - Enabled: false - -Performance/RangeInclude: - Enabled: false - -Performance/RedundantMatch: - Enabled: false - -Performance/RedundantMerge: - Enabled: true - MaxKeyValuePairs: 1 - -Performance/ReverseEach: - Enabled: true - -Performance/SelectMap: - Enabled: false - -Performance/Size: - Enabled: true - -Performance/StartWith: - Enabled: true - -Security/Eval: - Enabled: true - -Style/ArrayCoercion: - Enabled: false - -Style/ArrayJoin: - Enabled: true - -Style/AsciiComments: - Enabled: false - -Style/AutoResourceCleanup: - Enabled: false - -Style/BeginBlock: - Enabled: true - -Style/BlockComments: - Enabled: true - -Style/CaseEquality: - Enabled: true - -Style/CharacterLiteral: - Enabled: true - -Style/ClassMethods: - Enabled: true - -Style/ClassMethodsDefinitions: - Enabled: false - -Style/CollectionMethods: - Enabled: false - -Style/ConstantVisibility: - Enabled: false - -Style/Copyright: - Enabled: false - -Style/DateTime: - Enabled: false - -Style/DefWithParentheses: - Enabled: true - -Style/DisableCopsWithinSourceCodeDirective: - Enabled: false - -Style/Documentation: - Enabled: false - -Style/DocumentationMethod: - Enabled: false - -Style/EndBlock: - Enabled: true - -Style/For: - Enabled: true - -Style/FrozenStringLiteralComment: - Enabled: true - -Style/ImplicitRuntimeError: - Enabled: false - -Style/InlineComment: - Enabled: false - -Style/IpAddresses: - Enabled: false - -Style/HashSyntax: - Enabled: true - EnforcedStyle: ruby19_no_mixed_keys - -Style/LambdaCall: - Enabled: true - -Style/MethodCalledOnDoEndBlock: - Enabled: false - -Style/MethodCallWithoutArgsParentheses: - Enabled: true - -Style/MethodDefParentheses: - Enabled: true - -Style/MissingElse: - Enabled: false - -Style/MultilineIfThen: - Enabled: true - -Style/MultilineMethodSignature: - Enabled: false - -Style/NilComparison: - Enabled: true - -Style/Not: - Enabled: true - -Style/OneLineConditional: - Enabled: true - -Style/OptionHash: - Enabled: false - -Style/RedundantSortBy: - Enabled: true - -Style/ReturnNil: +Bundler/GemFilename: Enabled: false -Style/Sample: - Enabled: true - -Style/SingleLineBlockParams: +Bundler/GemVersion: Enabled: false -Style/StabbyLambdaParentheses: - Enabled: true - -Style/StaticClass: +Bundler/InsecureProtocolSource: Enabled: false -Style/Strip: +Bundler/OrderedGems: Enabled: true -Style/StringHashKeys: +Gemspec/DependencyVersion: Enabled: false -Style/StringLiterals: - Enabled: true - EnforcedStyle: double_quotes - -Style/StringMethods: +Gemspec/DeprecatedAttributeAssignment: Enabled: false -Style/TopLevelMethodDefinition: +Gemspec/DuplicatedAssignment: Enabled: false -Style/TrailingCommaInBlockArgs: +Gemspec/OrderedDependencies: Enabled: false -Style/UnlessLogicalOperators: +Gemspec/RequireMFA: Enabled: false -# TODO: Check if the following cops are in the GitHub Ruby styleguide; disable them if not. -# TODO: Add `StyleGuide` links for cops that are in the GitHub Ruby styleguide. -# TODO: It would be good to run an alphabetization script over these, to put them -# in the right places in this file. Also there are probably duplicates for rules -# that we already had enabled/disabled previously. - -Bundler/DuplicatedGem: - Enabled: true - -Bundler/GemFilename: - Enabled: true - -Bundler/InsecureProtocolSource: - Enabled: true - -Bundler/OrderedGems: - Enabled: true - -Gemspec/DuplicatedAssignment: - Enabled: true - -Gemspec/OrderedDependencies: - Enabled: true - Gemspec/RubyVersionGlobalsUsage: - Enabled: true + Enabled: false GitHub/InsecureHashAlgorithm: Enabled: true -GitHub/RailsApplicationRecord: - Enabled: true - -GitHub/RailsControllerRenderActionSymbol: - Enabled: true - -GitHub/RailsControllerRenderLiteral: - Enabled: true - -GitHub/RailsControllerRenderPathsExist: - Enabled: true - -GitHub/RailsControllerRenderShorthand: - Enabled: true - -GitHub/RailsRenderInline: - Enabled: true - -GitHub/RailsRenderObjectCollection: - Enabled: true - -GitHub/RailsViewRenderLiteral: - Enabled: true - -GitHub/RailsViewRenderPathsExist: - Enabled: true - -GitHub/RailsViewRenderShorthand: - Enabled: true - Layout/AccessModifierIndentation: - Enabled: true + Enabled: false Layout/ArgumentAlignment: - Enabled: true + Enabled: false Layout/ArrayAlignment: - Enabled: true + Enabled: false Layout/AssignmentIndentation: - Enabled: true + Enabled: false Layout/BeginEndAlignment: - Enabled: true + Enabled: false Layout/BlockAlignment: Enabled: true @@ -559,16 +63,19 @@ Layout/BlockEndNewline: Enabled: true Layout/CaseIndentation: - Enabled: true + Enabled: false + +Layout/ClassStructure: + Enabled: false Layout/ClosingHeredocIndentation: - Enabled: true + Enabled: false Layout/ClosingParenthesisIndentation: - Enabled: true + Enabled: false Layout/CommentIndentation: - Enabled: true + Enabled: false Layout/ConditionPosition: Enabled: true @@ -577,121 +84,175 @@ Layout/DefEndAlignment: Enabled: true Layout/DotPosition: - Enabled: true + Enabled: false Layout/ElseAlignment: - Enabled: true + Enabled: false Layout/EmptyComment: - Enabled: true + Enabled: false Layout/EmptyLineAfterGuardClause: - Enabled: true + Enabled: false Layout/EmptyLineAfterMagicComment: - Enabled: true + Enabled: false + +Layout/EmptyLineAfterMultilineCondition: + Enabled: false Layout/EmptyLineBetweenDefs: - Enabled: true + Enabled: false Layout/EmptyLines: - Enabled: true + Enabled: false Layout/EmptyLinesAroundAccessModifier: - Enabled: true + Enabled: false Layout/EmptyLinesAroundArguments: - Enabled: true + Enabled: false Layout/EmptyLinesAroundAttributeAccessor: - Enabled: true + Enabled: false Layout/EmptyLinesAroundBeginBody: - Enabled: true + Enabled: false Layout/EmptyLinesAroundBlockBody: - Enabled: true + Enabled: false Layout/EmptyLinesAroundClassBody: - Enabled: true + Enabled: false Layout/EmptyLinesAroundExceptionHandlingKeywords: - Enabled: true + Enabled: false Layout/EmptyLinesAroundMethodBody: - Enabled: true + Enabled: false Layout/EmptyLinesAroundModuleBody: - Enabled: true + Enabled: false + +Layout/EndAlignment: + Enabled: false Layout/EndOfLine: Enabled: true Layout/ExtraSpacing: - Enabled: true + Enabled: false Layout/FirstArgumentIndentation: - Enabled: true + Enabled: false Layout/FirstArrayElementIndentation: - Enabled: true + Enabled: false + +Layout/FirstArrayElementLineBreak: + Enabled: false Layout/FirstHashElementIndentation: - Enabled: true + Enabled: false + +Layout/FirstHashElementLineBreak: + Enabled: false + +Layout/FirstMethodArgumentLineBreak: + Enabled: false + +Layout/FirstMethodParameterLineBreak: + Enabled: false Layout/FirstParameterIndentation: - Enabled: true + Enabled: false Layout/HashAlignment: - Enabled: true + Enabled: false + +Layout/HeredocArgumentClosingParenthesis: + Enabled: false Layout/HeredocIndentation: - Enabled: true + Enabled: false Layout/IndentationConsistency: Enabled: true + EnforcedStyle: spaces + IndentationWidth: 2 Layout/IndentationStyle: - Enabled: true + Enabled: false Layout/IndentationWidth: Enabled: true + Width: 2 Layout/InitialIndentation: Enabled: true Layout/LeadingCommentSpace: - Enabled: true + Enabled: false Layout/LeadingEmptyLines: - Enabled: true + Enabled: false + +Layout/LineContinuationLeadingSpace: + Enabled: false + +Layout/LineContinuationSpacing: + Enabled: false + +Layout/LineEndStringConcatenationIndentation: + Enabled: false + +Layout/LineLength: + Enabled: false Layout/MultilineArrayBraceLayout: - Enabled: true + Enabled: false + +Layout/MultilineArrayLineBreaks: + Enabled: false + +Layout/MultilineAssignmentLayout: + Enabled: false Layout/MultilineBlockLayout: - Enabled: true + Enabled: false Layout/MultilineHashBraceLayout: - Enabled: true + Enabled: false + +Layout/MultilineHashKeyLineBreaks: + Enabled: false + +Layout/MultilineMethodArgumentLineBreaks: + Enabled: false Layout/MultilineMethodCallBraceLayout: - Enabled: true + Enabled: false Layout/MultilineMethodCallIndentation: - Enabled: true + Enabled: false Layout/MultilineMethodDefinitionBraceLayout: - Enabled: true + Enabled: false Layout/MultilineOperationIndentation: - Enabled: true + Enabled: false Layout/ParameterAlignment: - Enabled: true + Enabled: false + +Layout/RedundantLineBreak: + Enabled: false Layout/RescueEnsureAlignment: - Enabled: true + Enabled: false + +Layout/SingleLineBlockChain: + Enabled: false Layout/SpaceAfterColon: Enabled: true @@ -715,34 +276,38 @@ Layout/SpaceAroundEqualsInParameterDefault: Enabled: true Layout/SpaceAroundKeyword: - Enabled: true + Enabled: false Layout/SpaceAroundMethodCallOperator: - Enabled: true + Enabled: false Layout/SpaceAroundOperators: - Enabled: true + Enabled: false Layout/SpaceBeforeBlockBraces: Enabled: true +Layout/SpaceBeforeBrackets: + Enabled: false + Layout/SpaceBeforeComma: - Enabled: true + Enabled: false Layout/SpaceBeforeComment: - Enabled: true + Enabled: false Layout/SpaceBeforeFirstArg: - Enabled: true + Enabled: false Layout/SpaceBeforeSemicolon: - Enabled: true + Enabled: false Layout/SpaceInLambdaLiteral: - Enabled: true + Enabled: false Layout/SpaceInsideArrayLiteralBrackets: Enabled: true + EnforcedStyle: no_space Layout/SpaceInsideArrayPercentLiteral: Enabled: true @@ -751,13 +316,13 @@ Layout/SpaceInsideBlockBraces: Enabled: true Layout/SpaceInsideHashLiteralBraces: - Enabled: true + Enabled: false Layout/SpaceInsideParens: Enabled: true Layout/SpaceInsidePercentLiteralDelimiters: - Enabled: true + Enabled: false Layout/SpaceInsideRangeLiteral: Enabled: true @@ -766,7 +331,7 @@ Layout/SpaceInsideReferenceBrackets: Enabled: true Layout/SpaceInsideStringInterpolation: - Enabled: true + Enabled: false Layout/TrailingEmptyLines: Enabled: true @@ -774,29 +339,44 @@ Layout/TrailingEmptyLines: Layout/TrailingWhitespace: Enabled: true +Lint/AmbiguousAssignment: + Enabled: false + Lint/AmbiguousBlockAssociation: - Enabled: true + Enabled: false Lint/AmbiguousOperator: - Enabled: true + Enabled: false + +Lint/AmbiguousOperatorPrecedence: + Enabled: false + +Lint/AmbiguousRange: + Enabled: false Lint/AmbiguousRegexpLiteral: - Enabled: true + Enabled: false Lint/BigDecimalNew: - Enabled: true + Enabled: false Lint/BinaryOperatorWithIdenticalOperands: Enabled: true Lint/BooleanSymbol: - Enabled: true + Enabled: false Lint/CircularArgumentReference: Enabled: true -Lint/ConstantDefinitionInBlock: - Enabled: true +Lint/ConstantDefinitionInBlock: + Enabled: false + +Lint/ConstantOverwrittenInRescue: + Enabled: false + +Lint/ConstantResolution: + Enabled: false Lint/Debugger: Enabled: true @@ -804,17 +384,23 @@ Lint/Debugger: Lint/DeprecatedClassMethods: Enabled: true +Lint/DeprecatedConstants: + Enabled: false + Lint/DeprecatedOpenSSLConstant: - Enabled: true + Enabled: false Lint/DisjunctiveAssignmentInConstructor: - Enabled: true + Enabled: false + +Lint/DuplicateBranch: + Enabled: false Lint/DuplicateCaseCondition: - Enabled: true + Enabled: false Lint/DuplicateElsifCondition: - Enabled: true + Enabled: false Lint/DuplicateHashKey: Enabled: true @@ -822,11 +408,14 @@ Lint/DuplicateHashKey: Lint/DuplicateMethods: Enabled: true +Lint/DuplicateRegexpCharacterClassElement: + Enabled: false + Lint/DuplicateRequire: - Enabled: true + Enabled: false Lint/DuplicateRescueException: - Enabled: true + Enabled: false Lint/EachWithObjectArgument: Enabled: true @@ -837,29 +426,17 @@ Lint/ElseLayout: Lint/EmptyEnsure: Enabled: true -Lint/EmptyExpression: - Enabled: true - -Lint/EmptyFile: - Enabled: true - Lint/EmptyInterpolation: Enabled: true -Lint/EmptyWhen: - Enabled: true - Lint/EnsureReturn: Enabled: true -Lint/ErbNewArguments: - Enabled: true - Lint/FlipFlop: Enabled: true Lint/FloatComparison: - Enabled: true + Enabled: false Lint/FloatOutOfRange: Enabled: true @@ -868,22 +445,31 @@ Lint/FormatParameterMismatch: Enabled: true Lint/HashCompareByIdentity: - Enabled: true + Enabled: false + +Lint/HeredocMethodCallPosition: + Enabled: false Lint/IdentityComparison: - Enabled: true + Enabled: false Lint/ImplicitStringConcatenation: - Enabled: true + Enabled: false + +Lint/IncompatibleIoSelectWithFiberScheduler: + Enabled: false Lint/IneffectiveAccessModifier: - Enabled: true + Enabled: false Lint/InheritException: - Enabled: true + Enabled: false Lint/InterpolationCheck: - Enabled: true + Enabled: false + +Lint/LambdaWithoutLiteralBlock: + Enabled: false Lint/LiteralAsCondition: Enabled: true @@ -895,49 +481,64 @@ Lint/Loop: Enabled: true Lint/MissingCopEnableDirective: - Enabled: true + Enabled: false Lint/MissingSuper: - Enabled: true + Enabled: false Lint/MixedRegexpCaptureTypes: - Enabled: true + Enabled: false Lint/MultipleComparison: - Enabled: true + Enabled: false Lint/NestedMethodDefinition: - Enabled: true + Enabled: false Lint/NestedPercentLiteral: - Enabled: true + Enabled: false Lint/NextWithoutAccumulator: Enabled: true +Lint/NoReturnInBeginEndBlocks: + Enabled: false + +Lint/NonAtomicFileOperation: + Enabled: false + Lint/NonDeterministicRequireOrder: - Enabled: true + Enabled: false Lint/NonLocalExitFromIterator: - Enabled: true + Enabled: false + +Lint/NumberConversion: + Enabled: false + +Lint/NumberedParameterAssignment: + Enabled: false + +Lint/OrAssignmentToConstant: + Enabled: false Lint/OrderedMagicComments: - Enabled: true + Enabled: false Lint/OutOfRangeRegexpRef: - Enabled: true + Enabled: false Lint/ParenthesesAsGroupedExpression: - Enabled: true + Enabled: false Lint/PercentStringArray: - Enabled: true + Enabled: false Lint/PercentSymbolArray: - Enabled: true + Enabled: false Lint/RaiseException: - Enabled: true + Enabled: false Lint/RandOne: Enabled: true @@ -946,13 +547,16 @@ Lint/RedundantCopDisableDirective: Enabled: true Lint/RedundantCopEnableDirective: - Enabled: true + Enabled: false + +Lint/RedundantDirGlobSort: + Enabled: false Lint/RedundantRequireStatement: - Enabled: true + Enabled: false Lint/RedundantSafeNavigation: - Enabled: true + Enabled: false Lint/RedundantSplatExpansion: Enabled: true @@ -961,181 +565,268 @@ Lint/RedundantStringCoercion: Enabled: true Lint/RedundantWithIndex: - Enabled: true + Enabled: false Lint/RedundantWithObject: - Enabled: true + Enabled: false + +Lint/RefinementImportMethods: + Enabled: false Lint/RegexpAsCondition: - Enabled: true + Enabled: false Lint/RequireParentheses: Enabled: true +Lint/RequireRelativeSelfPath: + Enabled: false + Lint/RescueException: Enabled: true Lint/RescueType: - Enabled: true + Enabled: false Lint/ReturnInVoidContext: - Enabled: true + Enabled: false Lint/SafeNavigationChain: - Enabled: true + Enabled: false Lint/SafeNavigationConsistency: - Enabled: true + Enabled: false Lint/SafeNavigationWithEmpty: - Enabled: true + Enabled: false Lint/ScriptPermission: - Enabled: true + Enabled: false Lint/SelfAssignment: - Enabled: true + Enabled: false Lint/SendWithMixinArgument: - Enabled: true + Enabled: false Lint/ShadowedArgument: - Enabled: true + Enabled: false Lint/ShadowedException: - Enabled: true + Enabled: false Lint/ShadowingOuterLocalVariable: - Enabled: true + Enabled: false Lint/StructNewOverride: - Enabled: true + Enabled: false Lint/SuppressedException: - Enabled: true + Enabled: false + +Lint/SymbolConversion: + Enabled: false Lint/Syntax: - Enabled: true + Enabled: false + +Lint/ToEnumArguments: + Enabled: false Lint/ToJSON: - Enabled: true + Enabled: false Lint/TopLevelReturnWithArgument: - Enabled: true + Enabled: false Lint/TrailingCommaInAttributeDeclaration: - Enabled: true + Enabled: false + +Lint/TripleQuotes: + Enabled: false Lint/UnderscorePrefixedVariableName: Enabled: true +Lint/UnexpectedBlockArity: + Enabled: false + Lint/UnifiedInteger: - Enabled: true + Enabled: false + +Lint/UnmodifiedReduceAccumulator: + Enabled: false Lint/UnreachableCode: Enabled: true Lint/UnreachableLoop: - Enabled: true + Enabled: false Lint/UnusedBlockArgument: - Enabled: true + Enabled: false Lint/UnusedMethodArgument: - Enabled: true + Enabled: false Lint/UriEscapeUnescape: - Enabled: true + Enabled: false Lint/UriRegexp: - Enabled: true + Enabled: false Lint/UselessAccessModifier: - Enabled: true + Enabled: false Lint/UselessElseWithoutRescue: - Enabled: true + Enabled: false Lint/UselessMethodDefinition: - Enabled: true + Enabled: false + +Lint/UselessRuby2Keywords: + Enabled: false Lint/UselessSetterCall: Enabled: true Lint/UselessTimes: - Enabled: true + Enabled: false Lint/Void: Enabled: true +Metrics/AbcSize: + Enabled: false + +Metrics/BlockLength: + Enabled: false + +Metrics/BlockNesting: + Enabled: false + +Metrics/ClassLength: + Enabled: false + +Metrics/CyclomaticComplexity: + Enabled: false + +Metrics/MethodLength: + Enabled: false + +Metrics/ModuleLength: + Enabled: false + +Metrics/ParameterLists: + Enabled: false + +Metrics/PerceivedComplexity: + Enabled: false + Migration/DepartmentName: - Enabled: true + Enabled: false Naming/AccessorMethodName: - Enabled: true + Enabled: false Naming/AsciiIdentifiers: Enabled: true Naming/BinaryOperatorParameterName: - Enabled: true + Enabled: false + +Naming/BlockForwarding: + Enabled: false Naming/BlockParameterName: - Enabled: true + Enabled: false Naming/ClassAndModuleCamelCase: Enabled: true Naming/ConstantName: + Enabled: false + +Naming/FileName: Enabled: true Naming/HeredocDelimiterCase: - Enabled: true + Enabled: false Naming/HeredocDelimiterNaming: - Enabled: true + Enabled: false + +Naming/InclusiveLanguage: + Enabled: false Naming/MemoizedInstanceVariableName: - Enabled: true + Enabled: false Naming/MethodName: Enabled: true Naming/MethodParameterName: - Enabled: true + Enabled: false Naming/PredicateName: - Enabled: true + Enabled: false Naming/RescuedExceptionsVariableName: - Enabled: true + Enabled: false Naming/VariableName: - Enabled: true + Enabled: false Naming/VariableNumber: - Enabled: true + Enabled: false + +Performance/AncestorsInclude: + Enabled: false + +Performance/ArraySemiInfiniteRangeSlice: + Enabled: false + +Performance/BigDecimalWithNumericArgument: + Enabled: false Performance/BindCall: - Enabled: true + Enabled: false + +Performance/BlockGivenWithExplicitBlock: + Enabled: false Performance/Caller: - Enabled: true + Enabled: false + +Performance/CaseWhenSplat: + Enabled: false Performance/Casecmp: - Enabled: true + Enabled: false + +Performance/ChainArrayAllocation: + Enabled: false + +Performance/CollectionLiteralInLoop: + Enabled: false Performance/CompareWithBlock: - Enabled: true + Enabled: false + +Performance/ConcurrentMonotonicTime: + Enabled: false + +Performance/ConstantRegexp: + Enabled: false Performance/Count: Enabled: true Performance/DeletePrefix: - Enabled: true + Enabled: false Performance/DeleteSuffix: - Enabled: true + Enabled: false Performance/Detect: Enabled: true @@ -1147,562 +838,793 @@ Performance/EndWith: Enabled: true Performance/FixedSize: - Enabled: true + Enabled: false Performance/FlatMap: Enabled: true Performance/InefficientHashSearch: - Enabled: true + Enabled: false + +Performance/IoReadlines: + Enabled: false + +Performance/MapCompact: + Enabled: false + +Performance/MethodObjectAsBlock: + Enabled: false + +Performance/OpenStruct: + Enabled: false + +Performance/RangeInclude: + Enabled: false Performance/RedundantBlockCall: - Enabled: true + Enabled: false + +Performance/RedundantEqualityComparisonBlock: + Enabled: false + +Performance/RedundantMatch: + Enabled: false Performance/RedundantMerge: Enabled: true + MaxKeyValuePairs: 1 + +Performance/RedundantSortBlock: + Enabled: false + +Performance/RedundantSplitRegexpArgument: + Enabled: false + +Performance/RedundantStringChars: + Enabled: false Performance/RegexpMatch: - Enabled: true + Enabled: false Performance/ReverseEach: Enabled: true +Performance/ReverseFirst: + Enabled: false + +Performance/SelectMap: + Enabled: false + Performance/Size: Enabled: true +Performance/SortReverse: + Enabled: false + +Performance/Squeeze: + Enabled: false + Performance/StartWith: Enabled: true +Performance/StringIdentifierArgument: + Enabled: false + +Performance/StringInclude: + Enabled: false + Performance/StringReplacement: - Enabled: true + Enabled: false + +Performance/Sum: + Enabled: false Performance/TimesMap: - Enabled: true + Enabled: false Performance/UnfreezeString: - Enabled: true + Enabled: false Performance/UriDefaultParser: - Enabled: true + Enabled: false + +Security/CompoundHash: + Enabled: false Security/Eval: Enabled: true +Security/IoMethods: + Enabled: false + Security/JSONLoad: - Enabled: true + Enabled: false Security/MarshalLoad: - Enabled: true + Enabled: false Security/Open: - Enabled: true + Enabled: false Security/YAMLLoad: - Enabled: true + Enabled: false Style/AccessModifierDeclarations: - Enabled: true + Enabled: false Style/AccessorGrouping: - Enabled: true + Enabled: false Style/Alias: - Enabled: true + Enabled: false Style/AndOr: - Enabled: true + Enabled: false + +Style/ArgumentsForwarding: + Enabled: false + +Style/ArrayCoercion: + Enabled: false Style/ArrayJoin: Enabled: true +Style/AsciiComments: + Enabled: false + Style/Attr: - Enabled: true + Enabled: false + +Style/AutoResourceCleanup: + Enabled: false Style/BarePercentLiterals: - Enabled: true + Enabled: false Style/BeginBlock: Enabled: true Style/BisectedAttrAccessor: - Enabled: true + Enabled: false Style/BlockComments: Enabled: true Style/BlockDelimiters: - Enabled: true + Enabled: false Style/CaseEquality: Enabled: true Style/CaseLikeIf: - Enabled: true + Enabled: false Style/CharacterLiteral: Enabled: true Style/ClassAndModuleChildren: - Enabled: true + Enabled: false Style/ClassCheck: - Enabled: true + Enabled: false Style/ClassEqualityComparison: - Enabled: true + Enabled: false Style/ClassMethods: Enabled: true +Style/ClassMethodsDefinitions: + Enabled: false + Style/ClassVars: - Enabled: true + Enabled: false + +Style/CollectionCompact: + Enabled: false + +Style/CollectionMethods: + Enabled: false Style/ColonMethodCall: - Enabled: true + Enabled: false Style/ColonMethodDefinition: - Enabled: true + Enabled: false Style/CombinableLoops: - Enabled: true + Enabled: false Style/CommandLiteral: - Enabled: true + Enabled: false Style/CommentAnnotation: - Enabled: true + Enabled: false Style/CommentedKeyword: - Enabled: true + Enabled: false Style/ConditionalAssignment: - Enabled: true + Enabled: false + +Style/ConstantVisibility: + Enabled: false + +Style/Copyright: + Enabled: false + +Style/DateTime: + Enabled: false Style/DefWithParentheses: Enabled: true Style/Dir: - Enabled: true + Enabled: false + +Style/DisableCopsWithinSourceCodeDirective: + Enabled: false + +Style/DocumentDynamicEvalDefinition: + Enabled: false + +Style/Documentation: + Enabled: false + +Style/DocumentationMethod: + Enabled: false Style/DoubleCopDisableDirective: - Enabled: true + Enabled: false Style/DoubleNegation: - Enabled: true + Enabled: false Style/EachForSimpleLoop: - Enabled: true + Enabled: false Style/EachWithObject: - Enabled: true + Enabled: false Style/EmptyBlockParameter: - Enabled: true + Enabled: false Style/EmptyCaseCondition: - Enabled: true + Enabled: false Style/EmptyElse: - Enabled: true + Enabled: false Style/EmptyLambdaParameter: - Enabled: true + Enabled: false Style/EmptyLiteral: - Enabled: true + Enabled: false Style/EmptyMethod: - Enabled: true + Enabled: false Style/Encoding: - Enabled: true + Enabled: false Style/EndBlock: Enabled: true +Style/EndlessMethod: + Enabled: false + +Style/EnvHome: + Enabled: false + Style/EvalWithLocation: - Enabled: true + Enabled: false Style/EvenOdd: - Enabled: true + Enabled: false Style/ExpandPathArguments: - Enabled: true + Enabled: false Style/ExplicitBlockArgument: - Enabled: true + Enabled: false Style/ExponentialNotation: - Enabled: true + Enabled: false + +Style/FetchEnvVar: + Enabled: false + +Style/FileRead: + Enabled: false + +Style/FileWrite: + Enabled: false Style/FloatDivision: - Enabled: true + Enabled: false Style/For: Enabled: true Style/FormatString: - Enabled: true + Enabled: false Style/FormatStringToken: - Enabled: true + Enabled: false Style/FrozenStringLiteralComment: Enabled: true Style/GlobalStdStream: - Enabled: true + Enabled: false Style/GlobalVars: - Enabled: true + Enabled: false Style/HashAsLastArrayItem: - Enabled: true + Enabled: false + +Style/HashConversion: + Enabled: false Style/HashEachMethods: - Enabled: true + Enabled: false + +Style/HashExcept: + Enabled: false Style/HashLikeCase: - Enabled: true + Enabled: false Style/HashSyntax: Enabled: true + EnforcedStyle: ruby19_no_mixed_keys Style/HashTransformKeys: - Enabled: true + Enabled: false Style/HashTransformValues: - Enabled: true + Enabled: false Style/IdenticalConditionalBranches: - Enabled: true + Enabled: false Style/IfInsideElse: - Enabled: true + Enabled: false Style/IfUnlessModifier: - Enabled: true + Enabled: false Style/IfUnlessModifierOfIfUnless: - Enabled: true + Enabled: false + +Style/IfWithBooleanLiteralBranches: + Enabled: false Style/IfWithSemicolon: - Enabled: true + Enabled: false + +Style/ImplicitRuntimeError: + Enabled: false + +Style/InPatternThen: + Enabled: false Style/InfiniteLoop: - Enabled: true + Enabled: false + +Style/InlineComment: + Enabled: false Style/InverseMethods: - Enabled: true + Enabled: false + +Style/IpAddresses: + Enabled: false Style/KeywordParametersOrder: - Enabled: true + Enabled: false Style/Lambda: - Enabled: true + Enabled: false Style/LambdaCall: Enabled: true Style/LineEndConcatenation: - Enabled: true + Enabled: false + +Style/MapCompactWithConditionalBlock: + Enabled: false + +Style/MapToHash: + Enabled: false + +Style/MethodCallWithArgsParentheses: + Enabled: false Style/MethodCallWithoutArgsParentheses: Enabled: true +Style/MethodCalledOnDoEndBlock: + Enabled: false + Style/MethodDefParentheses: Enabled: true Style/MinMax: - Enabled: true + Enabled: false + +Style/MissingElse: + Enabled: false Style/MissingRespondToMissing: - Enabled: true + Enabled: false Style/MixinGrouping: - Enabled: true + Enabled: false Style/MixinUsage: - Enabled: true + Enabled: false Style/ModuleFunction: - Enabled: true + Enabled: false Style/MultilineBlockChain: - Enabled: true + Enabled: false Style/MultilineIfModifier: - Enabled: true + Enabled: false Style/MultilineIfThen: Enabled: true +Style/MultilineInPatternThen: + Enabled: false + Style/MultilineMemoization: - Enabled: true + Enabled: false + +Style/MultilineMethodSignature: + Enabled: false Style/MultilineTernaryOperator: - Enabled: true + Enabled: false Style/MultilineWhenThen: - Enabled: true + Enabled: false Style/MultipleComparison: - Enabled: true + Enabled: false Style/MutableConstant: - Enabled: true + Enabled: false Style/NegatedIf: - Enabled: true + Enabled: false + +Style/NegatedIfElseCondition: + Enabled: false Style/NegatedUnless: - Enabled: true + Enabled: false Style/NegatedWhile: - Enabled: true + Enabled: false + +Style/NestedFileDirname: + Enabled: false Style/NestedModifier: - Enabled: true + Enabled: false Style/NestedParenthesizedCalls: - Enabled: true + Enabled: false Style/NestedTernaryOperator: - Enabled: true + Enabled: false Style/NilComparison: Enabled: true +Style/NilLambda: + Enabled: false + Style/NonNilCheck: - Enabled: true + Enabled: false Style/Not: Enabled: true +Style/NumberedParameters: + Enabled: false + +Style/NumberedParametersLimit: + Enabled: false + Style/NumericLiteralPrefix: - Enabled: true + Enabled: false Style/NumericLiterals: - Enabled: true + Enabled: false Style/NumericPredicate: - Enabled: true + Enabled: false + +Style/ObjectThen: + Enabled: false Style/OneLineConditional: Enabled: true +Style/OpenStructUse: + Enabled: false + +Style/OptionHash: + Enabled: false + Style/OptionalArguments: - Enabled: true + Enabled: false Style/OptionalBooleanParameter: - Enabled: true + Enabled: false Style/OrAssignment: - Enabled: true + Enabled: false Style/ParallelAssignment: - Enabled: true + Enabled: false Style/ParenthesesAroundCondition: - Enabled: true + Enabled: false Style/PercentLiteralDelimiters: - Enabled: true + Enabled: false Style/PercentQLiterals: - Enabled: true + Enabled: false Style/PerlBackrefs: - Enabled: true + Enabled: false Style/PreferredHashMethods: - Enabled: true + Enabled: false Style/Proc: - Enabled: true + Enabled: false + +Style/QuotedSymbols: + Enabled: false Style/RaiseArgs: - Enabled: true + Enabled: false Style/RandomWithOffset: - Enabled: true + Enabled: false + +Style/RedundantArgument: + Enabled: false Style/RedundantAssignment: - Enabled: true + Enabled: false Style/RedundantBegin: - Enabled: true + Enabled: false Style/RedundantCapitalW: - Enabled: true + Enabled: false Style/RedundantCondition: - Enabled: true + Enabled: false Style/RedundantConditional: - Enabled: true + Enabled: false Style/RedundantException: - Enabled: true + Enabled: false Style/RedundantFetchBlock: - Enabled: true + Enabled: false Style/RedundantFileExtensionInRequire: - Enabled: true + Enabled: false Style/RedundantFreeze: - Enabled: true + Enabled: false + +Style/RedundantInitialize: + Enabled: false Style/RedundantInterpolation: - Enabled: true + Enabled: false Style/RedundantParentheses: - Enabled: true + Enabled: false Style/RedundantPercentQ: - Enabled: true + Enabled: false Style/RedundantRegexpCharacterClass: - Enabled: true + Enabled: false Style/RedundantRegexpEscape: - Enabled: true + Enabled: false Style/RedundantReturn: - Enabled: true + Enabled: false Style/RedundantSelf: - Enabled: true + Enabled: false Style/RedundantSelfAssignment: - Enabled: true + Enabled: false + +Style/RedundantSelfAssignmentBranch: + Enabled: false Style/RedundantSort: - Enabled: true + Enabled: false Style/RedundantSortBy: Enabled: true Style/RegexpLiteral: - Enabled: true + Enabled: false Style/RescueModifier: - Enabled: true + Enabled: false Style/RescueStandardError: - Enabled: true + Enabled: false + +Style/ReturnNil: + Enabled: false Style/SafeNavigation: - Enabled: true + Enabled: false Style/Sample: Enabled: true +Style/SelectByRegexp: + Enabled: false + Style/SelfAssignment: - Enabled: true + Enabled: false Style/Semicolon: - Enabled: true + Enabled: false + +Style/Send: + Enabled: false Style/SignalException: - Enabled: true + Enabled: false Style/SingleArgumentDig: - Enabled: true + Enabled: false + +Style/SingleLineBlockParams: + Enabled: false Style/SingleLineMethods: - Enabled: true + Enabled: false Style/SlicingWithRange: - Enabled: true + Enabled: false Style/SpecialGlobalVars: - Enabled: true + Enabled: false Style/StabbyLambdaParentheses: Enabled: true +Style/StaticClass: + Enabled: false + Style/StderrPuts: - Enabled: true + Enabled: false + +Style/StringChars: + Enabled: false Style/StringConcatenation: - Enabled: true + Enabled: false + +Style/StringHashKeys: + Enabled: false Style/StringLiterals: Enabled: true + EnforcedStyle: double_quotes Style/StringLiteralsInInterpolation: - Enabled: true + Enabled: false + +Style/StringMethods: + Enabled: false Style/Strip: Enabled: true Style/StructInheritance: - Enabled: true + Enabled: false + +Style/SwapValues: + Enabled: false Style/SymbolArray: - Enabled: true + Enabled: false Style/SymbolLiteral: - Enabled: true + Enabled: false Style/SymbolProc: - Enabled: true + Enabled: false Style/TernaryParentheses: - Enabled: true + Enabled: false + +Style/TopLevelMethodDefinition: + Enabled: false Style/TrailingBodyOnClass: - Enabled: true + Enabled: false Style/TrailingBodyOnMethodDefinition: - Enabled: true + Enabled: false Style/TrailingBodyOnModule: - Enabled: true + Enabled: false Style/TrailingCommaInArguments: - Enabled: true + Enabled: false Style/TrailingCommaInArrayLiteral: - Enabled: true + Enabled: false + +Style/TrailingCommaInBlockArgs: + Enabled: false Style/TrailingCommaInHashLiteral: - Enabled: true + Enabled: false Style/TrailingMethodEndStatement: - Enabled: true + Enabled: false Style/TrailingUnderscoreVariable: - Enabled: true + Enabled: false Style/TrivialAccessors: - Enabled: true + Enabled: false Style/UnlessElse: - Enabled: true + Enabled: false + +Style/UnlessLogicalOperators: + Enabled: false Style/UnpackFirst: - Enabled: true + Enabled: false Style/VariableInterpolation: - Enabled: true + Enabled: false Style/WhenThen: - Enabled: true + Enabled: false Style/WhileUntilDo: - Enabled: true + Enabled: false Style/WhileUntilModifier: - Enabled: true + Enabled: false Style/WordArray: - Enabled: true + Enabled: false Style/YodaCondition: - Enabled: true + Enabled: false Style/ZeroLengthPredicate: - Enabled: true + Enabled: false From baa90b2f99958a0bb4d27a375a584d05cd4dd5b8 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 12 Oct 2022 10:16:28 +0000 Subject: [PATCH 10/17] config/default: Fix `Layout/IndentationStyle` configuration - The alphabetization script didn't cope very well with all the extra options for some reason. --- config/default.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/default.yml b/config/default.yml index c34453d..96c2cd3 100644 --- a/config/default.yml +++ b/config/default.yml @@ -177,13 +177,13 @@ Layout/HeredocIndentation: Enabled: false Layout/IndentationConsistency: + Enabled: false + +Layout/IndentationStyle: Enabled: true EnforcedStyle: spaces IndentationWidth: 2 -Layout/IndentationStyle: - Enabled: false - Layout/IndentationWidth: Enabled: true Width: 2 From 5a1ede7b4931b877586ac3e03829661c03ddd734 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 12 Oct 2022 10:25:52 +0000 Subject: [PATCH 11/17] .rubocop.yml: Move `Enabled: false` cops into `config/default.yml` - We've now changed tactic such that we're not enabling any new cops for downstream consumers, so let's move the "locally" disabled cops for this codebase back into `config/default.yml` so that we don't enable them for downstream consumers by accident. Something like `Lint/AssignmentInCondition` that doesn't have an autocorrect would be particularly annoying to receive violations for when you're just trying to upgrade your project's version of this gem. --- .rubocop.yml | 27 --------------------------- config/default.yml | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 593983b..802a6e6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,33 +1,6 @@ inherit_from: ./config/default.yml -AllCops: - SuggestExtensions: false - -Gemspec/RequiredRubyVersion: - Enabled: false - -Lint/AssignmentInCondition: - Enabled: false - -Lint/EmptyConditionalBody: - Enabled: false - -Lint/UselessAssignment: - Enabled: false - Naming/FileName: Enabled: true Exclude: - "rubocop-github.gemspec" - -Style/Documentation: - Enabled: false - -Style/GuardClause: - Enabled: false - -Style/Next: - Enabled: false - -Style/SoleNestedConditional: - Enabled: false diff --git a/config/default.yml b/config/default.yml index 96c2cd3..37467f1 100644 --- a/config/default.yml +++ b/config/default.yml @@ -35,6 +35,9 @@ Gemspec/OrderedDependencies: Gemspec/RequireMFA: Enabled: false +Gemspec/RequiredRubyVersion: + Enabled: false + Gemspec/RubyVersionGlobalsUsage: Enabled: false @@ -357,6 +360,9 @@ Lint/AmbiguousRange: Lint/AmbiguousRegexpLiteral: Enabled: false +Lint/AssignmentInCondition: + Enabled: false + Lint/BigDecimalNew: Enabled: false @@ -423,6 +429,9 @@ Lint/EachWithObjectArgument: Lint/ElseLayout: Enabled: true +Lint/EmptyConditionalBody: + Enabled: false + Lint/EmptyEnsure: Enabled: true @@ -678,6 +687,9 @@ Lint/UriRegexp: Lint/UselessAccessModifier: Enabled: false +Lint/UselessAssignment: + Enabled: false + Lint/UselessElseWithoutRescue: Enabled: false @@ -1162,6 +1174,9 @@ Style/GlobalStdStream: Style/GlobalVars: Enabled: false +Style/GuardClause: + Enabled: false + Style/HashAsLastArrayItem: Enabled: false @@ -1325,6 +1340,9 @@ Style/NestedParenthesizedCalls: Style/NestedTernaryOperator: Enabled: false +Style/Next: + Enabled: false + Style/NilComparison: Enabled: true @@ -1514,6 +1532,9 @@ Style/SingleLineMethods: Style/SlicingWithRange: Enabled: false +Style/SoleNestedConditional: + Enabled: false + Style/SpecialGlobalVars: Enabled: false From 60a3a0431a533914f1fb2bc5db78a20f97327a31 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 12 Oct 2022 10:34:50 +0000 Subject: [PATCH 12/17] config/default: It's impossible to disable `Lint/Syntax` - Somehow this snuck in, but RuboCop errors: ``` Error: configuration for Syntax cop found in config/default.yml. It's not possible to disable this cop. ``` --- config/default.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/config/default.yml b/config/default.yml index 37467f1..dd87851 100644 --- a/config/default.yml +++ b/config/default.yml @@ -636,9 +636,6 @@ Lint/SuppressedException: Lint/SymbolConversion: Enabled: false -Lint/Syntax: - Enabled: false - Lint/ToEnumArguments: Enabled: false From 55b4ece5e7d251fea1044551c26b337fddb5f9eb Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 12 Oct 2022 10:38:51 +0000 Subject: [PATCH 13/17] Revert "Run `bundle exec rubocop -a` (or `-A`) on all the code in this repo" This reverts commit 53a0a37784c3d95c05edbc3f57023072b00ef607. This is because we've now disabled all the rules that would have been `DisabledByDefault`. This is so that downstream consumers don't get any nasty surprises. As a result, there should be no RuboCop linting violations in the code in this repo, so we can back out the changes to slim the diff: they're now redundant. Of course, it would be a good idea to go and make these changes at a later date, but we can do that when we enable the correct rules having matched each one up with its rationale in our styleguide. --- Rakefile | 2 +- .../cop/github/insecure_hash_algorithm.rb | 31 ++++++++++++------- .../cop/github/rails_application_record.rb | 6 ++-- .../rails_controller_render_action_symbol.rb | 2 +- .../github/rails_controller_render_literal.rb | 14 ++++++--- .../rails_controller_render_paths_exist.rb | 14 ++++++--- .../rails_controller_render_shorthand.rb | 4 +-- lib/rubocop/cop/github/rails_render_inline.rb | 4 ++- .../github/rails_render_object_collection.rb | 4 ++- .../cop/github/rails_view_render_literal.rb | 10 ++++-- .../github/rails_view_render_paths_exist.rb | 10 ++++-- .../cop/github/render_literal_helpers.rb | 2 +- test/test_insecure_hash_algorithm.rb | 2 +- test/test_rails_controller_render_literal.rb | 1 + 14 files changed, 69 insertions(+), 37 deletions(-) diff --git a/Rakefile b/Rakefile index 66dceb3..25e3326 100644 --- a/Rakefile +++ b/Rakefile @@ -4,7 +4,7 @@ require "bundler/gem_tasks" require "rake/testtask" require "rubocop/rake_task" -task default: %i[test rubocop] +task default: [:test, :rubocop] Rake::TestTask.new RuboCop::RakeTask.new diff --git a/lib/rubocop/cop/github/insecure_hash_algorithm.rb b/lib/rubocop/cop/github/insecure_hash_algorithm.rb index e9fb330..ab73ca1 100644 --- a/lib/rubocop/cop/github/insecure_hash_algorithm.rb +++ b/lib/rubocop/cop/github/insecure_hash_algorithm.rb @@ -64,7 +64,6 @@ class InsecureHashAlgorithm < Base def insecure_algorithm?(val) return false if val == :Digest # Don't match "Digest::Digest". - case alg_name(val) when *allowed_hash_functions false @@ -81,7 +80,7 @@ def not_just_encoding?(val) end def just_encoding?(val) - %i[hexencode bubblebabble].include?(val) + val == :hexencode || val == :bubblebabble end # Built-in hash functions are listed in these docs: @@ -100,7 +99,6 @@ def allowed_hash_functions def alg_name(val) return :nil if val.nil? return val.to_s.downcase unless val.is_a?(RuboCop::AST::Node) - case val.type when :sym, :str val.children.first.to_s.downcase @@ -110,19 +108,28 @@ def alg_name(val) end def on_const(const_node) - add_offense(const_node, message: MSG) if insecure_const?(const_node) && !digest_uuid?(const_node) + if insecure_const?(const_node) && !digest_uuid?(const_node) + add_offense(const_node, message: MSG) + end end def on_send(send_node) - if uuid_v3?(send_node) - add_offense(send_node, message: UUID_V3_MSG) unless allowed_hash_functions.include?("md5") - elsif uuid_v5?(send_node) - add_offense(send_node, message: UUID_V5_MSG) unless allowed_hash_functions.include?("sha1") - elsif openssl_hmac_new?(send_node) - add_offense(send_node, message: MSG) if openssl_hmac_new_insecure?(send_node) - elsif insecure_digest?(send_node) + case + when uuid_v3?(send_node) + unless allowed_hash_functions.include?("md5") + add_offense(send_node, message: UUID_V3_MSG) + end + when uuid_v5?(send_node) + unless allowed_hash_functions.include?("sha1") + add_offense(send_node, message: UUID_V5_MSG) + end + when openssl_hmac_new?(send_node) + if openssl_hmac_new_insecure?(send_node) + add_offense(send_node, message: MSG) + end + when insecure_digest?(send_node) add_offense(send_node, message: MSG) - elsif insecure_hash_lookup?(send_node) + when insecure_hash_lookup?(send_node) add_offense(send_node, message: MSG) end end diff --git a/lib/rubocop/cop/github/rails_application_record.rb b/lib/rubocop/cop/github/rails_application_record.rb index cfb1974..1ec30cf 100644 --- a/lib/rubocop/cop/github/rails_application_record.rb +++ b/lib/rubocop/cop/github/rails_application_record.rb @@ -17,9 +17,11 @@ class RailsApplicationRecord < Base PATTERN def on_class(node) - klass, superclass, = *node + klass, superclass, _ = *node - add_offense(superclass) if active_record_base_const?(superclass) && !application_record_const?(klass) + if active_record_base_const?(superclass) && !(application_record_const?(klass)) + add_offense(superclass) + end end end end diff --git a/lib/rubocop/cop/github/rails_controller_render_action_symbol.rb b/lib/rubocop/cop/github/rails_controller_render_action_symbol.rb index 8661833..e3d6eca 100644 --- a/lib/rubocop/cop/github/rails_controller_render_action_symbol.rb +++ b/lib/rubocop/cop/github/rails_controller_render_action_symbol.rb @@ -24,7 +24,7 @@ class RailsControllerRenderActionSymbol < Base def on_send(node) if sym_node = render_sym?(node) - add_offense(sym_node) do |_corrector| + add_offense(sym_node) do |corrector| register_offense(sym_node, node) end elsif option_pairs = render_with_options?(node) diff --git a/lib/rubocop/cop/github/rails_controller_render_literal.rb b/lib/rubocop/cop/github/rails_controller_render_literal.rb index edda84d..0f2efd3 100644 --- a/lib/rubocop/cop/github/rails_controller_render_literal.rb +++ b/lib/rubocop/cop/github/rails_controller_render_literal.rb @@ -60,10 +60,12 @@ def on_send(node) elsif option_pairs = render_with_options?(node) option_pairs = option_pairs.reject { |pair| options_key?(pair) } - return if option_pairs.any? { |pair| ignore_key?(pair) } + if option_pairs.any? { |pair| ignore_key?(pair) } + return + end if template_node = option_pairs.map { |pair| template_key?(pair) }.compact.first - unless literal?(template_node) + if !literal?(template_node) add_offense(node) return end @@ -73,7 +75,7 @@ def on_send(node) end if layout_node = option_pairs.map { |pair| layout_key?(pair) }.compact.first - unless literal?(layout_node) + if !literal?(layout_node) add_offense(node) return end @@ -89,14 +91,16 @@ def on_send(node) add_offense(node) return end - option_pairs = option_hash&.pairs + option_pairs = option_hash && option_hash.pairs else option_pairs = node.arguments[0].pairs end if option_pairs locals = option_pairs.map { |pair| locals_key?(pair) }.compact.first - add_offense(node) if locals && (!locals.hash_type? || !hash_with_literal_keys?(locals)) + if locals && (!locals.hash_type? || !hash_with_literal_keys?(locals)) + add_offense(node) + end end end end diff --git a/lib/rubocop/cop/github/rails_controller_render_paths_exist.rb b/lib/rubocop/cop/github/rails_controller_render_paths_exist.rb index 3f84ce2..126738a 100644 --- a/lib/rubocop/cop/github/rails_controller_render_paths_exist.rb +++ b/lib/rubocop/cop/github/rails_controller_render_paths_exist.rb @@ -27,16 +27,22 @@ def on_send(node) if args = render_str?(node) node, path = args - add_offense(node, message: "Template could not be found") unless resolve_template(path.to_s) + unless resolve_template(path.to_s) + add_offense(node, message: "Template could not be found") + end elsif pairs = render_options?(node) if pair = pairs.detect { |p| render_key?(p) } key, node, path = render_key?(pair) case key when :action, :template - add_offense(node, message: "Template could not be found") unless resolve_template(path.to_s) + unless resolve_template(path.to_s) + add_offense(node, message: "Template could not be found") + end when :partial - add_offense(node, message: "Partial template could not be found") unless resolve_partial(path.to_s) + unless resolve_partial(path.to_s) + add_offense(node, message: "Partial template could not be found") + end end end end @@ -44,7 +50,7 @@ def on_send(node) def resolve_template(path) cop_config["ViewPath"].each do |view_path| - if m = Dir["#{File.join(config.path_relative_to_config(view_path), path)}*"].first + if m = Dir[File.join(config.path_relative_to_config(view_path), path) + "*"].first return m end end diff --git a/lib/rubocop/cop/github/rails_controller_render_shorthand.rb b/lib/rubocop/cop/github/rails_controller_render_shorthand.rb index ae62f71..58069e1 100644 --- a/lib/rubocop/cop/github/rails_controller_render_shorthand.rb +++ b/lib/rubocop/cop/github/rails_controller_render_shorthand.rb @@ -28,8 +28,8 @@ def on_send(node) if value_node = action_key?(pair) comma = option_pairs.length > 1 ? ", " : "" corrected_source = node.source - .sub(/#{pair.source}(,\s*)?/, "") - .sub("render ", "render \"#{str(value_node)}\"#{comma}") + .sub(/#{pair.source}(,\s*)?/, "") + .sub("render ", "render \"#{str(value_node)}\"#{comma}") add_offense(node, message: "Use `#{corrected_source}` instead") do |corrector| corrector.replace(node.source_range, corrected_source) diff --git a/lib/rubocop/cop/github/rails_render_inline.rb b/lib/rubocop/cop/github/rails_render_inline.rb index 65c8fb5..8f76fb2 100644 --- a/lib/rubocop/cop/github/rails_render_inline.rb +++ b/lib/rubocop/cop/github/rails_render_inline.rb @@ -18,7 +18,9 @@ class RailsRenderInline < Base def on_send(node) if option_pairs = render_with_options?(node) - add_offense(node) if option_pairs.detect { |pair| inline_key?(pair) } + if option_pairs.detect { |pair| inline_key?(pair) } + add_offense(node) + end end end end diff --git a/lib/rubocop/cop/github/rails_render_object_collection.rb b/lib/rubocop/cop/github/rails_render_object_collection.rb index b5a13b5..38a27fa 100644 --- a/lib/rubocop/cop/github/rails_render_object_collection.rb +++ b/lib/rubocop/cop/github/rails_render_object_collection.rb @@ -31,7 +31,9 @@ def on_send(node) case object_sym when :object - suggestion = ", instead `render partial: #{partial_name.source}, locals: { #{File.basename(partial_name.children[0], '.html.erb')}: #{object_node.source} }`" if partial_name.children[0].is_a?(String) + if partial_name.children[0].is_a?(String) + suggestion = ", instead `render partial: #{partial_name.source}, locals: { #{File.basename(partial_name.children[0], '.html.erb')}: #{object_node.source} }`" + end add_offense(node, message: "Avoid `render object:`#{suggestion}") when :collection, :spacer_template add_offense(node, message: "Avoid `render collection:`") diff --git a/lib/rubocop/cop/github/rails_view_render_literal.rb b/lib/rubocop/cop/github/rails_view_render_literal.rb index d3070d3..c856386 100644 --- a/lib/rubocop/cop/github/rails_view_render_literal.rb +++ b/lib/rubocop/cop/github/rails_view_render_literal.rb @@ -34,10 +34,12 @@ def on_send(node) if render_literal?(node) elsif option_pairs = render_with_options?(node) - return if option_pairs.any? { |pair| ignore_key?(pair) } + if option_pairs.any? { |pair| ignore_key?(pair) } + return + end if partial_node = option_pairs.map { |pair| partial_key?(pair) }.compact.first - unless literal?(partial_node) + if !literal?(partial_node) add_offense(node) return end @@ -58,7 +60,9 @@ def on_send(node) if locals if locals.hash_type? - add_offense(node) unless hash_with_literal_keys?(locals) + if !hash_with_literal_keys?(locals) + add_offense(node) + end else add_offense(node) end diff --git a/lib/rubocop/cop/github/rails_view_render_paths_exist.rb b/lib/rubocop/cop/github/rails_view_render_paths_exist.rb index 6423416..49a40f2 100644 --- a/lib/rubocop/cop/github/rails_view_render_paths_exist.rb +++ b/lib/rubocop/cop/github/rails_view_render_paths_exist.rb @@ -27,12 +27,16 @@ def on_send(node) if args = render_str?(node) node, path = args - add_offense(node, message: "Partial template could not be found") unless resolve_partial(path.to_s) + unless resolve_partial(path.to_s) + add_offense(node, message: "Partial template could not be found") + end elsif pairs = render_options?(node) if pair = pairs.detect { |p| partial_key?(p) } node, path = partial_key?(pair) - add_offense(node, message: "Partial template could not be found") unless resolve_partial(path.to_s) + unless resolve_partial(path.to_s) + add_offense(node, message: "Partial template could not be found") + end end end end @@ -43,7 +47,7 @@ def resolve_partial(path) path = parts.join(File::SEPARATOR) cop_config["ViewPath"].each do |view_path| - if m = Dir["#{File.join(config.path_relative_to_config(view_path), path)}*"].first + if m = Dir[File.join(config.path_relative_to_config(view_path), path) + "*"].first return m end end diff --git a/lib/rubocop/cop/github/render_literal_helpers.rb b/lib/rubocop/cop/github/render_literal_helpers.rb index 6994fb7..67417a5 100644 --- a/lib/rubocop/cop/github/render_literal_helpers.rb +++ b/lib/rubocop/cop/github/render_literal_helpers.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true - +# require "rubocop" module RuboCop diff --git a/test/test_insecure_hash_algorithm.rb b/test/test_insecure_hash_algorithm.rb index 3e48aa9..597450b 100644 --- a/test/test_insecure_hash_algorithm.rb +++ b/test/test_insecure_hash_algorithm.rb @@ -10,7 +10,7 @@ def cop_class end def make_cop(allowed:) - config = RuboCop::Config.new({ "GitHub/InsecureHashAlgorithm" => { "Allowed" => allowed } }) + config = RuboCop::Config.new({"GitHub/InsecureHashAlgorithm" => {"Allowed" => allowed}}) cop_class.new(config) end diff --git a/test/test_rails_controller_render_literal.rb b/test/test_rails_controller_render_literal.rb index bd52c7f..9da2f16 100644 --- a/test/test_rails_controller_render_literal.rb +++ b/test/test_rails_controller_render_literal.rb @@ -442,6 +442,7 @@ def index assert_equal 1, offenses.count end + def test_render_literal_dynamic_local_key_offense offenses = investigate cop, <<-RUBY, "app/controllers/products_controller.rb" class ProductsController < ActionController::Base From d95509e71fa988c61d1e02a432a63d1c019d6988 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 12 Oct 2022 10:41:16 +0000 Subject: [PATCH 14/17] Revert "Fix `Naming/MemoizedInstanceVariableName` offenses" This reverts commit e36d683f6b85e7394775a02d9f6321f2cf34b4b5. This is because we've now disabled all the rules that would have been `DisabledByDefault`. This is so that downstream consumers don't get any nasty surprises. As a result, there should be no RuboCop linting violations in the code in this repo, so we can back out the changes to slim the diff: they're now redundant. Of course, it would be a good idea to go and make these changes at a later date, but we can do that when we enable the correct rules having matched each one up with its rationale in our styleguide. --- lib/rubocop/cop/github/insecure_hash_algorithm.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rubocop/cop/github/insecure_hash_algorithm.rb b/lib/rubocop/cop/github/insecure_hash_algorithm.rb index ab73ca1..de1b321 100644 --- a/lib/rubocop/cop/github/insecure_hash_algorithm.rb +++ b/lib/rubocop/cop/github/insecure_hash_algorithm.rb @@ -93,7 +93,7 @@ def just_encoding?(val) ].freeze def allowed_hash_functions - @allowed_hash_functions ||= cop_config.fetch("Allowed", DEFAULT_ALLOWED).map(&:downcase) + @allowed_algorithms ||= cop_config.fetch("Allowed", DEFAULT_ALLOWED).map(&:downcase) end def alg_name(val) From 70dc91b33d08103529870e11d675ab441759b7fb Mon Sep 17 00:00:00 2001 From: Issy Long Date: Wed, 12 Oct 2022 10:43:52 +0000 Subject: [PATCH 15/17] config/default: Set `Enabled: false` for new RuboCop rules - The following message appeared when I ran `bundle exec rubocop` on this project. Since we're setting everything to `Enabled: false` to mimic `DisabledByDefault` for now, let's make this message go away. We almost certainly also don't want to blanket enable all new cops, so I've not added that configuration. ``` The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file. Please also note that you can opt-in to new cops by default by adding this to your config: AllCops: NewCops: enable Lint/EmptyBlock: # new in 1.1 Enabled: true Lint/EmptyClass: # new in 1.3 Enabled: true Lint/EmptyInPattern: # new in 1.16 Enabled: true For more information: https://docs.rubocop.org/rubocop/versioning.html ``` --- config/default.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/default.yml b/config/default.yml index dd87851..6dcd009 100644 --- a/config/default.yml +++ b/config/default.yml @@ -429,6 +429,15 @@ Lint/EachWithObjectArgument: Lint/ElseLayout: Enabled: true +Lint/EmptyBlock: + Enabled: false + +Lint/EmptyClass: + Enabled: false + +Lint/EmptyInPattern: + Enabled: false + Lint/EmptyConditionalBody: Enabled: false From 42740863a57463c67a50cdc071f484f32e3be56f Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 13 Oct 2022 11:48:13 +0000 Subject: [PATCH 16/17] CHANGELOG: Note that no new rules are enabled in this release --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c42df4d..2dbdfa8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,4 +2,4 @@ ## Unreleased -- Unset `DisabledByDefault: true` in `config/default.yml`. This will use RuboCop's choice of default cops to enable, plus our existing augmentations in `config/default.yml`. Prevents confusing behaviour where downstream consumers didn't realise that RuboCop's default cops weren't being applied. (https://github.com/github/rubocop-github/pull/119) +- Unset `DisabledByDefault: true` in `config/default.yml`. Prevents confusing behaviour where users of the gem didn't realise that RuboCop's default cops weren't being applied (including potentially custom cops in their projects). We've explicitly set `Enabled: false` for all the cops that were previously default disabled. This has the effect that consumers of this gem won't be surprised by new linting violations when they use this new version in their projects. (https://github.com/github/rubocop-github/pull/119) From 6bbad25c67a56fc07e9d5ef3498e0861fcf34a33 Mon Sep 17 00:00:00 2001 From: Ben Sheldon Date: Thu, 13 Oct 2022 08:22:12 -0700 Subject: [PATCH 17/17] Disable all of the DisabledByDefault Rails cops too --- config/rails.yml | 401 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 360 insertions(+), 41 deletions(-) diff --git a/config/rails.yml b/config/rails.yml index 2782574..e414a00 100644 --- a/config/rails.yml +++ b/config/rails.yml @@ -2,22 +2,6 @@ require: - rubocop-github-rails - rubocop-rails -Rails/OutputSafety: - Enabled: true - -Rails/PluralizationGrammar: - Enabled: true - -Rails/RequestReferer: - Enabled: true - EnforcedStyle: referrer - -Rails/ScopeArgs: - Enabled: true - -Rails/UniqBeforePluck: - Enabled: true - GitHub/RailsApplicationRecord: Enabled: true @@ -48,48 +32,383 @@ GitHub/RailsViewRenderPathsExist: GitHub/RailsViewRenderShorthand: Enabled: true -# Exclude Rails ERB files from incompatible cops - Layout/BlockAlignment: Exclude: - - 'app/views/**/*.erb' + - app/views/**/*.erb -Style/For: - Exclude: - - 'app/views/**/*.erb' - -Style/OneLineConditional: +Layout/IndentationWidth: Exclude: - - 'app/views/**/*.erb' + - app/views/**/*.erb -Style/Semicolon: +Layout/InitialIndentation: Exclude: - - 'app/views/**/*.erb' + - app/views/**/*.erb Layout/SpaceInsideParens: Exclude: - - 'app/views/**/*.erb' - -Style/StringLiterals: - Exclude: - - 'app/views/**/*.erb' + - app/views/**/*.erb Layout/TrailingEmptyLines: Exclude: - - 'app/views/**/*.erb' + - app/views/**/*.erb Layout/TrailingWhitespace: Exclude: - - 'app/views/**/*.erb' + - app/views/**/*.erb -Layout/IndentationWidth: +Lint/UselessAccessModifier: + ContextCreatingMethods: + - concerning + +Rails/ActionControllerTestCase: + Enabled: false + +Rails/ActionFilter: + Enabled: false + +Rails/ActiveRecordAliases: + Enabled: false + +Rails/ActiveRecordCallbacksOrder: + Enabled: false + +Rails/ActiveRecordOverride: + Enabled: false + +Rails/ActiveSupportAliases: + Enabled: false + +Rails/AddColumnIndex: + Enabled: false + +Rails/AfterCommitOverride: + Enabled: false + +Rails/ApplicationController: + Enabled: false + +Rails/ApplicationJob: + Enabled: false + +Rails/ApplicationMailer: + Enabled: false + +Rails/ApplicationRecord: + Enabled: false + +Rails/ArelStar: + Enabled: false + +Rails/AssertNot: + Enabled: false + +Rails/AttributeDefaultBlockValue: + Enabled: false + +Rails/BelongsTo: + Enabled: false + +Rails/Blank: + Enabled: false + +Rails/BulkChangeTable: + Enabled: false + +Rails/CompactBlank: + Enabled: false + +Rails/ContentTag: + Enabled: false + +Rails/CreateTableWithTimestamps: + Enabled: false + +Rails/Date: + Enabled: false + +Rails/DefaultScope: + Enabled: false + +Rails/Delegate: + Enabled: false + +Rails/DelegateAllowBlank: + Enabled: false + +Rails/DeprecatedActiveModelErrorsMethods: + Enabled: false + +Rails/DotSeparatedKeys: + Enabled: false + +Rails/DuplicateAssociation: + Enabled: false + +Rails/DuplicateScope: + Enabled: false + +Rails/DurationArithmetic: + Enabled: false + +Rails/DynamicFindBy: + Enabled: false + +Rails/EagerEvaluationLogMessage: + Enabled: false + +Rails/EnumHash: + Enabled: false + +Rails/EnumUniqueness: + Enabled: false + +Rails/EnvironmentComparison: + Enabled: false + +Rails/EnvironmentVariableAccess: + Enabled: false + +Rails/Exit: + Enabled: false + +Rails/ExpandedDateRange: + Enabled: false + +Rails/FilePath: + Enabled: false + +Rails/FindBy: + Enabled: false + +Rails/FindById: + Enabled: false + +Rails/FindEach: + Enabled: false + +Rails/HasAndBelongsToMany: + Enabled: false + +Rails/HasManyOrHasOneDependent: + Enabled: false + +Rails/HelperInstanceVariable: + Enabled: false + +Rails/HttpPositionalArguments: + Enabled: false + +Rails/HttpStatus: + Enabled: false + +Rails/I18nLazyLookup: + Enabled: false + +Rails/I18nLocaleAssignment: + Enabled: false + +Rails/I18nLocaleTexts: + Enabled: false + +Rails/IgnoredSkipActionFilterOption: + Enabled: false + +Rails/IndexBy: + Enabled: false + +Rails/IndexWith: + Enabled: false + +Rails/Inquiry: + Enabled: false + +Rails/InverseOf: + Enabled: false + +Rails/LexicallyScopedActionFilter: + Enabled: false + +Rails/LinkToBlank: + Enabled: false + +Rails/MailerName: + Enabled: false + +Rails/MatchRoute: + Enabled: false + +Rails/MigrationClassName: + Enabled: false + +Rails/NegateInclude: + Enabled: false + +Rails/NotNullColumn: + Enabled: false + +Rails/OrderById: + Enabled: false + +Rails/Output: + Enabled: false + +Rails/OutputSafety: + Enabled: true + +Rails/Pick: + Enabled: false + +Rails/Pluck: + Enabled: false + +Rails/PluckId: + Enabled: false + +Rails/PluckInWhere: + Enabled: false + +Rails/PluralizationGrammar: + Enabled: true + +Rails/Presence: + Enabled: false + +Rails/Present: + Enabled: false + +Rails/RakeEnvironment: + Enabled: false + +Rails/ReadWriteAttribute: + Enabled: false + +Rails/RedundantAllowNil: + Enabled: false + +Rails/RedundantForeignKey: + Enabled: false + +Rails/RedundantPresenceValidationOnBelongsTo: + Enabled: false + +Rails/RedundantReceiverInWithOptions: + Enabled: false + +Rails/RedundantTravelBack: + Enabled: false + +Rails/ReflectionClassName: + Enabled: false + +Rails/RefuteMethods: + Enabled: false + +Rails/RelativeDateConstant: + Enabled: false + +Rails/RenderInline: + Enabled: false + +Rails/RenderPlainText: + Enabled: false + +Rails/RequestReferer: + Enabled: true + EnforcedStyle: referrer + +Rails/RequireDependency: + Enabled: false + +Rails/ReversibleMigration: + Enabled: false + +Rails/ReversibleMigrationMethodDefinition: + Enabled: false + +Rails/RootJoinChain: + Enabled: false + +Rails/RootPublicPath: + Enabled: false + +Rails/SafeNavigation: + Enabled: false + +Rails/SafeNavigationWithBlank: + Enabled: false + +Rails/SaveBang: + Enabled: false + +Rails/SchemaComment: + Enabled: false + +Rails/ScopeArgs: + Enabled: true + +Rails/ShortI18n: + Enabled: false + +Rails/SkipsModelValidations: + Enabled: false + +Rails/SquishedSQLHeredocs: + Enabled: false + +Rails/StripHeredoc: + Enabled: false + +Rails/TableNameAssignment: + Enabled: false + +Rails/TimeZone: + Enabled: false + +Rails/TimeZoneAssignment: + Enabled: false + +Rails/ToFormattedS: + Enabled: false + +Rails/TransactionExitStatement: + Enabled: false + +Rails/UniqBeforePluck: + Enabled: true + +Rails/UniqueValidationWithoutIndex: + Enabled: false + +Rails/UnknownEnv: + Enabled: false + +Rails/UnusedIgnoredColumns: + Enabled: false + +Rails/Validation: + Enabled: false + +Rails/WhereEquals: + Enabled: false + +Rails/WhereExists: + Enabled: false + +Rails/WhereNot: + Enabled: false + +Style/For: Exclude: - - 'app/views/**/*.erb' + - app/views/**/*.erb -Layout/InitialIndentation: +Style/OneLineConditional: Exclude: - - 'app/views/**/*.erb' + - app/views/**/*.erb -Lint/UselessAccessModifier: - ContextCreatingMethods: - - concerning +Style/Semicolon: + Exclude: + - app/views/**/*.erb + +Style/StringLiterals: + Exclude: + - app/views/**/*.erb