From 0065d2a6eff7e233967269b527ef7e9a18d8f03b Mon Sep 17 00:00:00 2001 From: Volmer Campos Soares Date: Fri, 1 Apr 2022 14:56:54 -0400 Subject: [PATCH] Remove redundant configuration keys --- rubocop.yml | 12 ------------ test/config_test.rb | 25 +++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 12 deletions(-) diff --git a/rubocop.yml b/rubocop.yml index fa2c5c36..471936bc 100644 --- a/rubocop.yml +++ b/rubocop.yml @@ -24,9 +24,6 @@ Layout/ArgumentAlignment: Layout/CaseIndentation: EnforcedStyle: end -Layout/EmptyLineAfterGuardClause: - Enabled: true - Layout/EndAlignment: EnforcedStyleAlignWith: variable @@ -370,9 +367,6 @@ Style/AndOr: Style/ArgumentsForwarding: Enabled: false -Style/AsciiComments: - Enabled: false - Style/BisectedAttrAccessor: Enabled: false @@ -439,9 +433,6 @@ Style/EvalWithLocation: Style/ExpandPathArguments: Enabled: false -Style/ExplicitBlockArgument: - Enabled: true - Style/ExponentialNotation: Enabled: false @@ -463,9 +454,6 @@ Style/FrozenStringLiteralComment: literals will become the default in a future Ruby version, and we want to make sure we''re ready.' -Style/GlobalStdStream: - Enabled: true - Style/GuardClause: Enabled: false diff --git a/test/config_test.rb b/test/config_test.rb index d879b596..125cedae 100644 --- a/test/config_test.rb +++ b/test/config_test.rb @@ -30,4 +30,29 @@ def test_config_is_unchanged assert(diff.empty?, error_message) end end + + def test_config_has_no_redundant_entries + config = RuboCop::ConfigLoader.load_file("rubocop.yml") + default_config = RuboCop::ConfigLoader.default_configuration + + # This entry is not a cop. + config.delete("inherit_mode") + + config.each do |cop_name, cop_config| + default_cop_config = default_config.fetch(cop_name) + cop_config.each do |key, value| + error_message = <<~ERROR + Error: #{cop_name} was configured with the same value as the default + RuboCop configuration. + + #{cop_name}: + #{key}: #{value} + + Please remove the configuration as it is unnecessary. + ERROR + + refute_equal(default_cop_config[key], value, error_message) + end + end + end end