From bc566bfefc7763190f9e0057f5a9cdf07108be1a Mon Sep 17 00:00:00 2001 From: Daniel Azuma Date: Wed, 24 Apr 2024 16:26:59 -0700 Subject: [PATCH] feat: Require Ruby 3.0 and support new checks as of Rubocop 1.63 (#74) --- .github/workflows/ci.yml | 6 +++--- .github/workflows/release-please.yml | 6 +++--- google-style.gemspec | 4 ++-- google-style.yml | 22 +++++++++++++++++++++- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ef375b..54d5a3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,19 +13,19 @@ jobs: strategy: matrix: include: - - os: ubuntu-latest - ruby: "2.7" - os: ubuntu-latest ruby: "3.0" - os: ubuntu-latest ruby: "3.1" - os: ubuntu-latest ruby: "3.2" + - os: ubuntu-latest + ruby: "3.3" fail-fast: false runs-on: ${{ matrix.os }} steps: - name: Checkout repo - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + uses: actions/checkout@v4 - name: Install Ruby ${{ matrix.ruby }} uses: ruby/setup-ruby@v1 with: diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index e3f940b..2486330 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -18,11 +18,11 @@ jobs: RELEASE_PLEASE_DISABLE: ${{ secrets.RELEASE_PLEASE_DISABLE }} steps: - name: Checkout repo - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - - name: Install Ruby 3.0 + uses: actions/checkout@v4 + - name: Install Ruby 3.3 uses: ruby/setup-ruby@v1 with: - ruby-version: "3.0" + ruby-version: "3.3" - name: Install NodeJS 16.x uses: actions/setup-node@v4 with: diff --git a/google-style.gemspec b/google-style.gemspec index ff70e2e..0daf5e4 100644 --- a/google-style.gemspec +++ b/google-style.gemspec @@ -31,7 +31,7 @@ Gem::Specification.new do |gem| "README.md", "google-style.yml", "lib/google/style/version.rb"] - gem.required_ruby_version = ">= 2.7.0" + gem.required_ruby_version = ">= 3.0.0" - gem.add_dependency "rubocop", "~> 1.56" + gem.add_dependency "rubocop", "~> 1.63" end diff --git a/google-style.yml b/google-style.yml index 0805d48..485f6b1 100644 --- a/google-style.yml +++ b/google-style.yml @@ -15,7 +15,7 @@ AllCops: NewCops: disable SuggestExtensions: false - TargetRubyVersion: 2.7 + TargetRubyVersion: 3.0 # Added in Rubocop 1.30 Gemspec/DeprecatedAttributeAssignment: @@ -120,10 +120,18 @@ Lint/EmptyInPattern: Lint/IncompatibleIoSelectWithFiberScheduler: Enabled: true +# Added in Rubocop 1.59 +Lint/ItWithoutArgumentsInBlock: + Enabled: true + # Added in Rubocop 1.8 Lint/LambdaWithoutLiteralBlock: Enabled: true +# Added in Rubocop 1.58 +Lint/LiteralAssignmentInCondition: + Enabled: true + # Added in Rubocop 1.53 Lint/MixedCaseRange: Enabled: true @@ -345,6 +353,10 @@ Style/MagicCommentFormat: Style/MapCompactWithConditionalBlock: Enabled: true +# Added in Rubocop 1.63 +Style/MapIntoArray: + Enabled: true + # Added in Rubocop 1.24 Style/MapToHash: Enabled: true @@ -504,6 +516,10 @@ Style/ReturnNilInPredicateMethodDefinition: Style/SelectByRegexp: Enabled: false +# Added in Rubocop 1.57 +Style/SingleLineDoEndBlock: + Enabled: true + # Added in Rubocop 1.12 Style/StringChars: Enabled: true @@ -512,6 +528,10 @@ Style/StringChars: Style/StringLiterals: EnforcedStyle: double_quotes +# We prefer omitting parentheses where possible. +Style/SuperWithArgsParentheses: + Enabled: false + # Added in Rubocop 1.1 Style/SwapValues: Enabled: true