From 2ec5998493eb1016959b74e5316b003be0361e2d Mon Sep 17 00:00:00 2001 From: Jennifer Konikowski Date: Mon, 3 May 2021 13:07:48 -0400 Subject: [PATCH] Update rubocop and rubocop-performance and finally add in some new cops * Update rubocop from 1.12.1 to [1.13.0](https://github.com/rubocop-hq/rubocop/releases/tag/v1.13.0) * Update rubocop-performance from 1.9.2 to [1.11.1](https://github.com/rubocop-hq/rubocop-performance/releases/tag/v1.11.1) * Enabled the following rules: * [`Performance/RedundantSplitRegexpArgument`](https://github.com/rubocop/rubocop-performance/pull/190) * [`Style/IfWithBooleanLiteralBranches`](https://github.com/rubocop-hq/rubocop/pull/9396) * [`Lint/TripleQuotes`](https://github.com/rubocop-hq/rubocop/pull/9402) * [`Lint/SymbolConversion`](https://github.com/rubocop/rubocop/pull/9362) * [`Lint/OrAssignmentToConstant`](https://github.com/rubocop-hq/rubocop/pull/9363) * [`Lint/NumberedParameterAssignment`](https://github.com/rubocop-hq/rubocop/pull/9326) * [`Style/HashConversion`](https://github.com/rubocop-hq/rubocop/pull/9478) * [`Gemspec/DateAssignment`](https://github.com/rubocop-hq/rubocop/pull/9496) * [`Style/StringChars`](https://github.com/rubocop/rubocop/pull/9615) --- CHANGELOG.md | 15 +++++++++++ Gemfile.lock | 22 +++++++-------- config/base.yml | 27 +++++++++++++++++++ config/ruby-1.9.yml | 3 +++ config/ruby-2.3.yml | 5 +--- config/ruby-2.4.yml | 4 +++ .../assigns_rubocop_yaml.rb | 2 ++ .../sets_target_ruby_version.rb | 2 +- standard.gemspec | 6 ++--- test/standard/builds_config_test.rb | 2 +- 10 files changed, 68 insertions(+), 20 deletions(-) create mode 100644 config/ruby-2.4.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index a4422e30..439adf08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,20 @@ # Changelog +## unreleased + +* Update rubocop from 1.12.1 to [1.13.0](https://github.com/rubocop-hq/rubocop/releases/tag/v1.13.0) +* Update rubocop-performance from 1.9.2 to [1.11.1](https://github.com/rubocop-hq/rubocop-performance/releases/tag/v1.11.1) +* Enabled the following rules: + * [`Performance/RedundantSplitRegexpArgument`](https://github.com/rubocop/rubocop-performance/pull/190) + * [`Style/IfWithBooleanLiteralBranches`](https://github.com/rubocop-hq/rubocop/pull/9396) + * [`Lint/TripleQuotes`](https://github.com/rubocop-hq/rubocop/pull/9402) + * [`Lint/SymbolConversion`](https://github.com/rubocop/rubocop/pull/9362) + * [`Lint/OrAssignmentToConstant`](https://github.com/rubocop-hq/rubocop/pull/9363) + * [`Lint/NumberedParameterAssignment`](https://github.com/rubocop-hq/rubocop/pull/9326) + * [`Style/HashConversion`](https://github.com/rubocop-hq/rubocop/pull/9478) + * [`Gemspec/DateAssignment`](https://github.com/rubocop-hq/rubocop/pull/9496) + * [`Style/StringChars`](https://github.com/rubocop/rubocop/pull/9615) + ## 1.0.5 * Update rubocop from 1.11.0 to [1.12.1](https://github.com/rubocop-hq/rubocop/releases/tag/v1.12.1) diff --git a/Gemfile.lock b/Gemfile.lock index ee3baa39..17907611 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,8 +2,8 @@ PATH remote: . specs: standard (1.0.5) - rubocop (= 1.12.1) - rubocop-performance (= 1.10.1) + rubocop (= 1.13.0) + rubocop-performance (= 1.11.1) GEM remote: https://rubygems.org/ @@ -15,16 +15,16 @@ GEM method_source (1.0.0) minitest (5.14.4) parallel (1.20.1) - parser (3.0.1.0) + parser (3.0.1.1) ast (~> 2.4.1) - pry (0.14.0) + pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) rainbow (3.0.0) rake (13.0.3) regexp_parser (2.1.1) rexml (3.2.5) - rubocop (1.12.1) + rubocop (1.13.0) parallel (~> 1.10) parser (>= 3.0.0.0) rainbow (>= 2.2.2, < 4.0) @@ -33,10 +33,10 @@ GEM rubocop-ast (>= 1.2.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.4.1) - parser (>= 2.7.1.5) - rubocop-performance (1.10.1) - rubocop (>= 0.90.0, < 2.0) + rubocop-ast (1.5.0) + parser (>= 3.0.1.1) + rubocop-performance (1.11.1) + rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) ruby-progressbar (1.11.0) simplecov (0.21.2) @@ -44,7 +44,7 @@ GEM simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) - simplecov_json_formatter (0.1.2) + simplecov_json_formatter (0.1.3) unicode-display_width (2.0.0) PLATFORMS @@ -61,4 +61,4 @@ DEPENDENCIES standard! BUNDLED WITH - 2.2.3 + 2.2.6 diff --git a/config/base.yml b/config/base.yml index ffb128fa..cff6961a 100644 --- a/config/base.yml +++ b/config/base.yml @@ -21,6 +21,9 @@ Bundler/InsecureProtocolSource: - '**/Gemfile' - '**/gems.rb' +Gemspec/DateAssignment: + Enabled: true + Gemspec/DuplicatedAssignment: Enabled: true Include: @@ -478,6 +481,12 @@ Lint/NonDeterministicRequireOrder: Lint/NonLocalExitFromIterator: Enabled: true +Lint/NumberedParameterAssignment: + Enabled: true + +Lint/OrAssignmentToConstant: + Enabled: true + Lint/OrderedMagicComments: Enabled: true @@ -557,6 +566,9 @@ Lint/ShadowedArgument: Lint/ShadowedException: Enabled: true +Lint/SymbolConversion: + Enabled: true + Lint/Syntax: Enabled: true @@ -566,6 +578,9 @@ Lint/TopLevelReturnWithArgument: Lint/TrailingCommaInAttributeDeclaration: Enabled: true +Lint/TripleQuotes: + Enabled: true + Lint/UnderscorePrefixedVariableName: Enabled: true @@ -689,6 +704,9 @@ Performance/RedundantMerge: Performance/RedundantSortBlock: Enabled: true +Performance/RedundantSplitRegexpArgument: + Enabled: true + Performance/RedundantStringChars: Enabled: true @@ -854,6 +872,9 @@ Style/GlobalVars: Enabled: true AllowedVariables: [] +Style/HashConversion: + Enabled: true + Style/HashExcept: Enabled: true @@ -870,6 +891,9 @@ Style/IfInsideElse: Style/IfUnlessModifierOfIfUnless: Enabled: true +Style/IfWithBooleanLiteralBranches: + Enabled: true + Style/IfWithSemicolon: Enabled: true @@ -1089,6 +1113,9 @@ Style/StabbyLambdaParentheses: Style/StderrPuts: Enabled: true +Style/StringChars: + Enabled: true + Style/StringLiterals: Enabled: true EnforcedStyle: double_quotes diff --git a/config/ruby-1.9.yml b/config/ruby-1.9.yml index e8fb83b4..badb96cb 100644 --- a/config/ruby-1.9.yml +++ b/config/ruby-1.9.yml @@ -2,3 +2,6 @@ inherit_from: ./ruby-2.2.yml Style/Encoding: Enabled: false + +Style/HashConversion: + Enabled: false diff --git a/config/ruby-2.3.yml b/config/ruby-2.3.yml index e7edec8d..e63d5caa 100644 --- a/config/ruby-2.3.yml +++ b/config/ruby-2.3.yml @@ -1,4 +1 @@ -inherit_from: ./ruby-2.5.yml - -AllCops: - TargetRubyVersion: 2.4 # The oldest supported +inherit_from: ./ruby-2.4.yml diff --git a/config/ruby-2.4.yml b/config/ruby-2.4.yml new file mode 100644 index 00000000..0225000c --- /dev/null +++ b/config/ruby-2.4.yml @@ -0,0 +1,4 @@ +inherit_from: ./ruby-2.5.yml + +AllCops: + TargetRubyVersion: 2.5 # The oldest supported diff --git a/lib/standard/creates_config_store/assigns_rubocop_yaml.rb b/lib/standard/creates_config_store/assigns_rubocop_yaml.rb index 3e0a4c7e..22cc75fc 100644 --- a/lib/standard/creates_config_store/assigns_rubocop_yaml.rb +++ b/lib/standard/creates_config_store/assigns_rubocop_yaml.rb @@ -18,6 +18,8 @@ def rubocop_yaml_path(desired_version) "ruby-2.2.yml" elsif desired_version < Gem::Version.new("2.4") "ruby-2.3.yml" + elsif desired_version < Gem::Version.new("2.5") + "ruby-2.4.yml" elsif desired_version < Gem::Version.new("2.6") "ruby-2.5.yml" elsif desired_version < Gem::Version.new("3.0") diff --git a/lib/standard/creates_config_store/sets_target_ruby_version.rb b/lib/standard/creates_config_store/sets_target_ruby_version.rb index cbb806b4..955201da 100644 --- a/lib/standard/creates_config_store/sets_target_ruby_version.rb +++ b/lib/standard/creates_config_store/sets_target_ruby_version.rb @@ -9,7 +9,7 @@ def call(options_config, standard_config) private def max_rubocop_supported_version(desired_version) - rubocop_supported_version = Gem::Version.new("2.4") + rubocop_supported_version = Gem::Version.new("2.5") if desired_version < rubocop_supported_version rubocop_supported_version else diff --git a/standard.gemspec b/standard.gemspec index e5a44d57..98557cc2 100644 --- a/standard.gemspec +++ b/standard.gemspec @@ -7,7 +7,7 @@ Gem::Specification.new do |spec| spec.version = Standard::VERSION spec.authors = ["Justin Searls"] spec.email = ["searls@gmail.com"] - spec.required_ruby_version = ">= 2.4.0" + spec.required_ruby_version = ">= 2.5.0" spec.summary = "Ruby Style Guide, with linter & automatic code fixer" spec.homepage = "https://github.com/testdouble/standard" @@ -19,6 +19,6 @@ Gem::Specification.new do |spec| spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } spec.require_paths = ["lib"] - spec.add_dependency "rubocop", "1.12.1" - spec.add_dependency "rubocop-performance", "1.10.1" + spec.add_dependency "rubocop", "1.13.0" + spec.add_dependency "rubocop-performance", "1.11.1" end diff --git a/test/standard/builds_config_test.rb b/test/standard/builds_config_test.rb index b3ed1219..4644f76f 100644 --- a/test/standard/builds_config_test.rb +++ b/test/standard/builds_config_test.rb @@ -74,7 +74,7 @@ def test_19 assert_equal DEFAULT_OPTIONS, result.rubocop_options - assert_equal config_store("test/fixture/config/w", "config/ruby-1.9.yml", 2.4), result.rubocop_config_store.for("").to_h + assert_equal config_store("test/fixture/config/w", "config/ruby-1.9.yml", 2.5), result.rubocop_config_store.for("").to_h end def test_specified_standard_yaml_overrides_local