From 8174bdd118d27d2a7650d50320fd8f7396a7d308 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Thu, 7 Nov 2024 05:58:05 +0700 Subject: [PATCH 01/19] =?UTF-8?q?=F0=9F=93=8C=20Loosen=20RuboCop=20dep=20r?= =?UTF-8?q?equirements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- betterlint.gemspec | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/betterlint.gemspec b/betterlint.gemspec index 3de9b4d..69f9b4d 100644 --- a/betterlint.gemspec +++ b/betterlint.gemspec @@ -24,10 +24,10 @@ Gem::Specification.new do |s| s.required_ruby_version = ">= 3.0" - s.add_dependency "rubocop", "~> 1.62.0" - s.add_dependency "rubocop-graphql", "~> 1.5.0" - s.add_dependency "rubocop-performance", "~> 1.21.0" - s.add_dependency "rubocop-rails", "~> 2.24.0" - s.add_dependency "rubocop-rake", "~> 0.6.0" - s.add_dependency "rubocop-rspec", "~> 2.28.0" + s.add_dependency "rubocop", "~> 1.62" + s.add_dependency "rubocop-graphql", "~> 1.5" + s.add_dependency "rubocop-performance", "~> 1.21" + s.add_dependency "rubocop-rails", "~> 2.24" + s.add_dependency "rubocop-rake", "~> 0.6" + s.add_dependency "rubocop-rspec", "~> 2.28" end From 0a37ca8d6cb5e9c7cea6ec82673ae5d0c1b5fba2 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 12:27:59 -0700 Subject: [PATCH 02/19] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Upgrade=20dependenci?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 190 ++++++++++++++++++++++++++------------------------- 1 file changed, 98 insertions(+), 92 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 55038ed..6be6c17 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,82 +2,88 @@ PATH remote: . specs: betterlint (1.16.0) - rubocop (~> 1.62.0) - rubocop-graphql (~> 1.5.0) - rubocop-performance (~> 1.21.0) - rubocop-rails (~> 2.24.0) - rubocop-rake (~> 0.6.0) - rubocop-rspec (~> 2.28.0) + rubocop (~> 1.62) + rubocop-graphql (~> 1.5) + rubocop-performance (~> 1.21) + rubocop-rails (~> 2.24) + rubocop-rake (~> 0.6) + rubocop-rspec (~> 2.28) GEM remote: https://rubygems.org/ specs: - actionpack (7.1.4.1) - actionview (= 7.1.4.1) - activesupport (= 7.1.4.1) + actionpack (8.0.1) + actionview (= 8.0.1) + activesupport (= 8.0.1) nokogiri (>= 1.8.5) - racc rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actionview (7.1.4.1) - activesupport (= 7.1.4.1) + useragent (~> 0.16) + actionview (8.0.1) + activesupport (= 8.0.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activesupport (7.1.4.1) + activesupport (8.0.1) base64 + benchmark (>= 0.3) bigdecimal - concurrent-ruby (~> 1.0, >= 1.0.2) + concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) + logger (>= 1.4.2) minitest (>= 5.1) - mutex_m - tzinfo (~> 2.0) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) ast (2.4.2) base64 (0.2.0) + benchmark (0.4.0) bigdecimal (3.1.8) builder (3.3.0) coderay (1.1.3) concurrent-ruby (1.3.4) connection_pool (2.4.1) crass (1.0.6) - diff-lcs (1.5.0) + date (3.4.1) + diff-lcs (1.5.1) drb (2.2.1) - erubi (1.13.0) + erubi (1.13.1) i18n (1.14.6) concurrent-ruby (~> 1.0) - io-console (0.7.1) - irb (1.11.0) - rdoc - reline (>= 0.3.8) - json (2.7.1) + io-console (0.8.0) + irb (1.14.3) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + json (2.9.1) language_server-protocol (3.17.0.3) lint_roller (1.1.0) - loofah (2.22.0) + logger (1.6.4) + loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) - method_source (1.0.0) - minitest (5.25.1) - mutex_m (0.2.0) - nokogiri (1.16.7-arm64-darwin) + method_source (1.1.0) + minitest (5.25.4) + nokogiri (1.17.2-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86_64-darwin) + nokogiri (1.17.2-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.7-x86_64-linux) + nokogiri (1.17.2-x86_64-linux) racc (~> 1.4) - parallel (1.24.0) - parser (3.3.0.5) + parallel (1.26.3) + parser (3.3.6.0) ast (~> 2.4.1) racc - pry (0.14.2) + pry (0.15.0) coderay (~> 1.1) method_source (~> 1.0) - psych (5.1.2) + psych (5.2.2) + date stringio racc (1.8.1) rack (3.1.8) @@ -85,111 +91,111 @@ GEM rack (>= 3.0.0) rack-test (2.1.0) rack (>= 1.3) - rackup (2.1.0) + rackup (2.2.1) rack (>= 3) - webrick (~> 1.8) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.0) + rails-html-sanitizer (1.6.2) loofah (~> 2.21) - nokogiri (~> 1.14) - railties (7.1.4.1) - actionpack (= 7.1.4.1) - activesupport (= 7.1.4.1) - irb + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) + irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.1.0) - rdoc (6.6.3.1) + rake (13.2.1) + rdoc (6.10.0) psych (>= 4.0.0) - regexp_parser (2.9.0) - reline (0.4.1) + regexp_parser (2.9.3) + reline (0.6.0) io-console (~> 0.5) - rexml (3.3.6) - strscan - rspec-core (3.12.2) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.3) + rspec-core (3.13.2) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.3) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.6) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.2) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-rails (6.1.0) - actionpack (>= 6.1) - activesupport (>= 6.1) - railties (>= 6.1) - rspec-core (~> 3.12) - rspec-expectations (~> 3.12) - rspec-mocks (~> 3.12) - rspec-support (~> 3.12) - rspec-support (3.12.1) - rubocop (1.62.1) + rspec-support (~> 3.13.0) + rspec-rails (7.1.0) + actionpack (>= 7.0) + activesupport (>= 7.0) + railties (>= 7.0) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) + rspec-support (3.13.2) + rubocop (1.69.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) - regexp_parser (>= 1.8, < 3.0) - rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.31.1, < 2.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.36.2, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) - rubocop-ast (1.31.2) - parser (>= 3.3.0.4) - rubocop-capybara (2.19.0) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.37.0) + parser (>= 3.3.1.0) + rubocop-capybara (2.21.0) rubocop (~> 1.41) - rubocop-factory_bot (2.24.0) - rubocop (~> 1.33) - rubocop-graphql (1.5.1) - rubocop (>= 0.90, < 2) - rubocop-performance (1.21.0) + rubocop-factory_bot (2.26.1) + rubocop (~> 1.61) + rubocop-graphql (1.5.4) + rubocop (>= 1.50, < 2) + rubocop-performance (1.23.0) rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails (2.24.1) + rubocop-rails (2.27.0) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.33.0, < 2.0) + rubocop (>= 1.52.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) - rubocop-rspec (2.28.0) + rubocop-rspec (2.31.0) rubocop (~> 1.40) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) rubocop-rspec_rails (~> 2.28) - rubocop-rspec_rails (2.28.2) - rubocop (~> 1.40) + rubocop-rspec_rails (2.29.1) + rubocop (~> 1.61) ruby-progressbar (1.13.0) - standard (1.35.1) + securerandom (0.4.1) + standard (1.43.0) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.0) - rubocop (~> 1.62.0) + rubocop (~> 1.69.1) standard-custom (~> 1.0.0) - standard-performance (~> 1.3) + standard-performance (~> 1.6) standard-custom (1.0.2) lint_roller (~> 1.0) rubocop (~> 1.50) - standard-performance (1.4.0) + standard-performance (1.6.0) lint_roller (~> 1.1) - rubocop-performance (~> 1.21.0) - stringio (3.1.0) - strscan (3.1.0) - thor (1.3.0) + rubocop-performance (~> 1.23.0) + stringio (3.1.2) + thor (1.3.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.5.0) - webrick (1.8.2) - zeitwerk (2.6.12) + unicode-display_width (3.1.2) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) + uri (1.0.2) + useragent (0.16.11) + zeitwerk (2.7.1) PLATFORMS arm64-darwin-22 arm64-darwin-23 + arm64-darwin-24 x86_64-darwin-22 x86_64-linux From ab4ca49010842c6efbce69a1e77e20c4fcd2c25f Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 12:30:13 -0700 Subject: [PATCH 03/19] =?UTF-8?q?=F0=9F=9A=A8=20Lint=20updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/rubocop/cop/betterment/authorization_in_controller.rb | 2 +- lib/rubocop/cop/betterment/non_standard_actions.rb | 3 +-- lib/rubocop/cop/betterment/unsafe_job.rb | 2 +- lib/rubocop/cop/betterment/unscoped_find.rb | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/rubocop/cop/betterment/authorization_in_controller.rb b/lib/rubocop/cop/betterment/authorization_in_controller.rb index 804471b..9aa31d9 100644 --- a/lib/rubocop/cop/betterment/authorization_in_controller.rb +++ b/lib/rubocop/cop/betterment/authorization_in_controller.rb @@ -34,7 +34,7 @@ class AuthorizationInController < Cop PATTERN def initialize(config = nil, options = nil) - super(config, options) + super config = @config.for_cop(self) @unsafe_parameters = config.fetch("unsafe_parameters", []).map(&:to_sym) @unsafe_regex = Regexp.new config.fetch("unsafe_regex", ".*_id$") diff --git a/lib/rubocop/cop/betterment/non_standard_actions.rb b/lib/rubocop/cop/betterment/non_standard_actions.rb index 6c20243..109cb25 100644 --- a/lib/rubocop/cop/betterment/non_standard_actions.rb +++ b/lib/rubocop/cop/betterment/non_standard_actions.rb @@ -62,9 +62,8 @@ def check_raw_route(node) end end - # NOTE: The InternalAffairs/UndefinedConfig rule seems to have a bug where it can't fine these configs in config/default.yml def allowed_actions - @allowed_actions ||= cop_config['StandardActions'] + cop_config['AdditionalAllowedActions'] # rubocop:disable InternalAffairs/UndefinedConfig + @allowed_actions ||= cop_config['StandardActions'] + cop_config['AdditionalAllowedActions'] end def allowed_action?(action) diff --git a/lib/rubocop/cop/betterment/unsafe_job.rb b/lib/rubocop/cop/betterment/unsafe_job.rb index f715ced..1c6559b 100644 --- a/lib/rubocop/cop/betterment/unsafe_job.rb +++ b/lib/rubocop/cop/betterment/unsafe_job.rb @@ -14,7 +14,7 @@ class UnsafeJob < Cop MSG def initialize(config = nil, options = nil) - super(config, options) + super config = @config.for_cop(self) @sensitive_params = config.fetch("sensitive_params", []).map(&:to_sym) @class_regex = Regexp.new config.fetch("class_regex", ".*Job$") diff --git a/lib/rubocop/cop/betterment/unscoped_find.rb b/lib/rubocop/cop/betterment/unscoped_find.rb index fe3aa8e..4a12e0e 100644 --- a/lib/rubocop/cop/betterment/unscoped_find.rb +++ b/lib/rubocop/cop/betterment/unscoped_find.rb @@ -36,7 +36,7 @@ class UnscopedFind < Cop PATTERN def initialize(config = nil, options = nil) - super(config, options) + super config = @config.for_cop(self) @unauthenticated_models = config.fetch("unauthenticated_models", []).map(&:to_sym) end From 71ff05f535921e0c6a2145d44f8886cb95cd47fc Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 12:36:11 -0700 Subject: [PATCH 04/19] =?UTF-8?q?=F0=9F=91=B7=20Ruby=203.0=20config=20runs?= =?UTF-8?q?=20Ruby=203.3=20when=20unquoted,=20due=20to=20YAML=20parser=20l?= =?UTF-8?q?imitation.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - https://github.com/Betterment/betterlint/actions/runs/12437356175/job/34727086761?pr=63 - ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [x86_64-linux] --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 13641ab..9e94604 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: [3.0, 3.1, 3.2] + ruby: ["3.0", "3.1", "3.2"] gemfile: - Gemfile From 57585b577b4eedcffa61bf65633c1b969fcba5bf Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 12:39:16 -0700 Subject: [PATCH 05/19] =?UTF-8?q?=F0=9F=93=8C=20Upgrade=20to=20actions/che?= =?UTF-8?q?ckout@v4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9e94604..aef57cd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: - Gemfile steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 env: BUNDLE_GEMFILE: ${{ matrix.gemfile }} From ae3f2d1d352811ba89664150e35225520c3a0e61 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 14:38:42 -0700 Subject: [PATCH 06/19] =?UTF-8?q?=E2=9C=A8=20=20Appraisals?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/heads.yml | 51 +++++++++++++++++ .github/workflows/style.yml | 39 +++++++++++++ .github/workflows/tests.yml | 107 +++++++++++++++++++++++++++++------ .gitignore | 2 + Appraisals | 77 +++++++++++++++++++++++++ Gemfile | 16 +++--- Gemfile.lock | 88 ++++++++++++++++++++++++++++- README.md | 12 ++++ appraisal_root.gemfile | 20 +++++++ appraisal_root.gemfile.lock | 108 ++++++++++++++++++++++++++++++++++++ gemfiles/rails_6_1.gemfile | 11 ++++ gemfiles/rails_7_0.gemfile | 11 ++++ gemfiles/rails_7_1.gemfile | 11 ++++ gemfiles/rails_7_2.gemfile | 11 ++++ gemfiles/rails_8_0.gemfile | 11 ++++ gemfiles/style.gemfile | 14 +++++ 16 files changed, 563 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/heads.yml create mode 100644 .github/workflows/style.yml create mode 100644 Appraisals create mode 100644 appraisal_root.gemfile create mode 100644 appraisal_root.gemfile.lock create mode 100644 gemfiles/rails_6_1.gemfile create mode 100644 gemfiles/rails_7_0.gemfile create mode 100644 gemfiles/rails_7_1.gemfile create mode 100644 gemfiles/rails_7_2.gemfile create mode 100644 gemfiles/rails_8_0.gemfile create mode 100644 gemfiles/style.gemfile diff --git a/.github/workflows/heads.yml b/.github/workflows/heads.yml new file mode 100644 index 0000000..d6d5b73 --- /dev/null +++ b/.github/workflows/heads.yml @@ -0,0 +1,51 @@ +name: heads + +on: [push, pull_request] + +jobs: + test: + name: Specs - Ruby ${{ matrix.ruby }} ${{ matrix.appraisal }}${{ matrix.name_extra || '' }} + env: # $BUNDLE_GEMFILE must be set at job level, so it is set for all steps + BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}.gemfile + runs-on: ubuntu-latest + continue-on-error: ${{ matrix.experimental || endsWith(matrix.ruby, 'head') }} + strategy: + fail-fast: true + matrix: + include: + # ruby-head + - ruby: "head" + appraisal: "rails-8-0" + taskname: "spec" + gemfile: "appraisal_root" + rubygems: latest + bundler: latest + + # truffleruby-head + - ruby: "truffleruby-head" + appraisal: "rails-8-0" + taskname: "spec" + gemfile: "appraisal_root" + rubygems: latest + bundler: latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Ruby & RubyGems + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + rubygems: ${{ matrix.rubygems }} + bundler: ${{ matrix.bundler }} + bundler-cache: false + # `bundle` uses BUNDLE_GEMFILE, set automatically via matrix.gemfile (i.e. appraisal_root) + # We need to do this first to get appraisal installed. + # NOTE: We do not use the root Gemfile in CI workflows at all. + - name: Bundle for Appraisal ${{ matrix.appraisal }} on Ruby ${{ matrix.ruby }} + run: bundle + - name: Install Appraisal ${{ matrix.appraisal }} dependencies on Ruby ${{ matrix.ruby }} + run: bundle exec appraisal ${{ matrix.appraisal }} bundle + - name: Run ${{ matrix.appraisal }} tests via ${{ matrix.taskname }} on Ruby ${{ matrix.ruby }} + run: bundle exec appraisal ${{ matrix.appraisal }} bundle exec rake ${{ matrix.taskname }} diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml new file mode 100644 index 0000000..1ad2387 --- /dev/null +++ b/.github/workflows/style.yml @@ -0,0 +1,39 @@ +name: style + +on: [push, pull_request] + +jobs: + rubocop: + name: RuboCop + strategy: + fail-fast: false + matrix: + include: + - ruby: "3.3" + appraisal: "style" + taskname: "rubocop" + gemfile: "appraisal_root" + rubygems: latest + bundler: latest + runs-on: ubuntu-latest + env: # $BUNDLE_GEMFILE must be set at job level, so it is set for all steps + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Ruby & RubyGems + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + rubygems: ${{ matrix.rubygems }} + bundler: ${{ matrix.bundler }} + bundler-cache: false + # `bundle` uses BUNDLE_GEMFILE, set automatically via matrix.gemfile (i.e. appraisal_root) + # We need to do this first to get appraisal installed. + # NOTE: We do not use the root Gemfile in CI workflows at all. + - name: Bundle for Appraisal ${{ matrix.appraisal }} on Ruby ${{ matrix.ruby }} + run: bundle + - name: Install Appraisal ${{ matrix.appraisal }} dependencies on Ruby ${{ matrix.ruby }} + run: bundle exec appraisal ${{ matrix.appraisal }} bundle + - name: Run ${{ matrix.appraisal }} style checks via ${{ matrix.taskname }} on Ruby ${{ matrix.ruby }} + run: bundle exec appraisal ${{ matrix.appraisal }} bundle exec rake ${{ matrix.taskname }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index aef57cd..e3453d2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,23 +8,98 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["3.0", "3.1", "3.2"] - gemfile: - - Gemfile + include: + # Ruby 3.0 + - ruby: "3.0" + appraisal: "rails-6-1" + taskname: "spec" + gemfile: "appraisal_root" + rubygems: '3.5.23' + bundler: '2.5.23' + - ruby: "3.0" + appraisal: "rails-7-0" + taskname: "spec" + gemfile: "appraisal_root" + rubygems: '3.5.23' + bundler: '2.5.23' + - ruby: "3.0" + appraisal: "rails-7-1" + taskname: "spec" + gemfile: "appraisal_root" + rubygems: '3.5.23' + bundler: '2.5.23' + + # Ruby 3.1 + - ruby: "3.1" + appraisal: "rails-7-0" + taskname: "spec" + gemfile: "appraisal_root" + rubygems: latest + bundler: latest + - ruby: "3.1" + appraisal: "rails-7-1" + taskname: "spec" + gemfile: "appraisal_root" + rubygems: latest + bundler: latest + - ruby: "3.1" + appraisal: "rails-7-2" + taskname: "spec" + gemfile: "appraisal_root" + rubygems: latest + bundler: latest + + # Ruby 3.2 + - ruby: "3.2" + appraisal: "rails-7-1" + taskname: "spec" + gemfile: "appraisal_root" + rubygems: latest + bundler: latest + - ruby: "3.2" + appraisal: "rails-7-2" + taskname: "spec" + gemfile: "appraisal_root" + rubygems: latest + bundler: latest + - ruby: "3.2" + appraisal: "rails-8-0" + taskname: "spec" + gemfile: "appraisal_root" + rubygems: latest + bundler: latest + + # Ruby 3.3 + - ruby: "3.3" + appraisal: "rails-7-2" + taskname: "spec" + gemfile: "appraisal_root" + rubygems: latest + bundler: latest + - ruby: "3.3" + appraisal: "rails-8-0" + taskname: "spec" + gemfile: "appraisal_root" + rubygems: latest + bundler: latest steps: - - uses: actions/checkout@v4 - - uses: ruby/setup-ruby@v1 - env: - BUNDLE_GEMFILE: ${{ matrix.gemfile }} + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Ruby & RubyGems + uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Run linter - env: - BUNDLE_GEMFILE: ${{ matrix.gemfile }} - run: bundle exec rubocop --parallel - - name: Run tests - env: - BUNDLE_GEMFILE: ${{ matrix.gemfile }} - run: bundle exec rake + rubygems: ${{ matrix.rubygems }} + bundler: ${{ matrix.bundler }} + bundler-cache: false + # `bundle` uses BUNDLE_GEMFILE, set automatically via matrix.gemfile (i.e. appraisal_root) + # We need to do this first to get appraisal installed. + # NOTE: We do not use the root Gemfile in CI workflows at all. + - name: Bundle for Appraisal ${{ matrix.appraisal }} on Ruby ${{ matrix.ruby }} + run: bundle + - name: Install Appraisal ${{ matrix.appraisal }} dependencies on Ruby ${{ matrix.ruby }} + run: bundle exec appraisal ${{ matrix.appraisal }} bundle + - name: Run ${{ matrix.appraisal }} tests via ${{ matrix.taskname }} on Ruby ${{ matrix.ruby }} + run: bundle exec appraisal ${{ matrix.appraisal }} bundle exec rake ${{ matrix.taskname }} diff --git a/.gitignore b/.gitignore index c1ebcea..6bffc09 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /pkg /.idea + +gemfiles/*.gemfile.lock diff --git a/Appraisals b/Appraisals new file mode 100644 index 0000000..254c2f4 --- /dev/null +++ b/Appraisals @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +# Appraisals + +# To update Appraisal-generated gemfiles/*.gemfile run: +# BUNDLE_GEMFILE=appraisal_root.gemfile bundle update +# BUNDLE_GEMFILE=appraisal_root.gemfile appraisal update +# BUNDLE_GEMFILE=gemfiles/style.gemfile bundle exec rubocop -A --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment + +appraise "style" do + gem "mutex_m", "~> 0.2" + gem "rails", ">= 6.1" + gem "rake", ">= 13" + gem "rubocop-packaging", "~> 0.5", ">= 0.5.2" + # Skip some bad releases of standard + gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" + gem "stringio", "~> 3.0" +end + +# Compat: Ruby >= 2.5 +# Test Matrix: +# - Ruby 2.5 +# - Ruby 2.6 +# - Ruby 2.7 +# + Ruby 3.0 +appraise "rails-6-1" do + gem "mutex_m", "~> 0.2" + gem "rails", "~> 6.1.7.10" + gem "stringio", "~> 3.0" +end + +# Compat: Ruby >= 2.7 +# Test Matrix: +# - Ruby 2.7 +# + Ruby 3.0 +# + Ruby 3.1 +appraise "rails-7-0" do + gem "mutex_m", "~> 0.2" + gem "rails", "~> 7.0.8", ">= 7.0.8.7" + gem "stringio", "~> 3.0" +end + +# Compat: Ruby >= 2.7 +# Test Matrix: +# - Ruby 2.7 +# + Ruby 3.0 +# + Ruby 3.1 +# + Ruby 3.2 +appraise "rails-7-1" do + gem "mutex_m", "~> 0.2" + gem "rails", "~> 7.1.5", ">= 7.1.5.1" + gem "stringio", "~> 3.0" +end + +# Compat: Ruby >= 3.1 +# Test Matrix: +# + Ruby 3.1 +# + Ruby 3.2 +# + Ruby 3.3 +appraise "rails-7-2" do + gem "mutex_m", "~> 0.2" + gem "rails", "~> 7.2.2", ">= 7.2.2.1" + gem "stringio", "~> 3.0" +end + +# Compat: Ruby >= 3.2 +# Test Matrix: +# + Ruby 3.2 +# + Ruby 3.3 +# + ruby-head +# + truffleruby-head +# - jruby-head +appraise "rails-8-0" do + gem "mutex_m", "~> 0.2" + gem "rails", "~> 8.0.1" + gem "stringio", "~> 3.0" +end diff --git a/Gemfile b/Gemfile index d95b235..d504260 100644 --- a/Gemfile +++ b/Gemfile @@ -2,10 +2,12 @@ source 'https://rubygems.org' gemspec -group :development do - gem 'pry' - gem 'bundler' - gem 'rspec-rails' - gem 'rake', '>= 12.3.3' - gem 'standard' -end +# NOTE: Not adding appraisal here, because it should not be run against this Gemfile. +# See: `appraisal_root.gemfile` +gem 'rails', '>= 6.1' +gem 'pry' +gem 'rspec-rails' +gem 'rake', '>= 13' +gem 'rubocop-packaging', '~> 0.5', '>= 0.5.2' +# Skip some bad releases of standard +gem 'standard', '>= 1.35.1', '!= 1.41.1', '!= 1.42.0' diff --git a/Gemfile.lock b/Gemfile.lock index 6be6c17..07235c8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -12,6 +12,26 @@ PATH GEM remote: https://rubygems.org/ specs: + actioncable (8.0.1) + actionpack (= 8.0.1) + activesupport (= 8.0.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + zeitwerk (~> 2.6) + actionmailbox (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) + mail (>= 2.8.0) + actionmailer (8.0.1) + actionpack (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activesupport (= 8.0.1) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) actionpack (8.0.1) actionview (= 8.0.1) activesupport (= 8.0.1) @@ -22,12 +42,34 @@ GEM rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) + actiontext (8.0.1) + actionpack (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) actionview (8.0.1) activesupport (= 8.0.1) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) + activejob (8.0.1) + activesupport (= 8.0.1) + globalid (>= 0.3.6) + activemodel (8.0.1) + activesupport (= 8.0.1) + activerecord (8.0.1) + activemodel (= 8.0.1) + activesupport (= 8.0.1) + timeout (>= 0.4.0) + activestorage (8.0.1) + actionpack (= 8.0.1) + activejob (= 8.0.1) + activerecord (= 8.0.1) + activesupport (= 8.0.1) + marcel (~> 1.0) activesupport (8.0.1) base64 benchmark (>= 0.3) @@ -54,6 +96,8 @@ GEM diff-lcs (1.5.1) drb (2.2.1) erubi (1.13.1) + globalid (1.2.1) + activesupport (>= 6.1) i18n (1.14.6) concurrent-ruby (~> 1.0) io-console (0.8.0) @@ -67,8 +111,25 @@ GEM loofah (2.23.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) method_source (1.1.0) + mini_mime (1.1.5) minitest (5.25.4) + net-imap (0.5.3) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + nio4r (2.7.4) nokogiri (1.17.2-arm64-darwin) racc (~> 1.4) nokogiri (1.17.2-x86_64-darwin) @@ -93,6 +154,20 @@ GEM rack (>= 1.3) rackup (2.2.1) rack (>= 3) + rails (8.0.1) + actioncable (= 8.0.1) + actionmailbox (= 8.0.1) + actionmailer (= 8.0.1) + actionpack (= 8.0.1) + actiontext (= 8.0.1) + actionview (= 8.0.1) + activejob (= 8.0.1) + activemodel (= 8.0.1) + activerecord (= 8.0.1) + activestorage (= 8.0.1) + activesupport (= 8.0.1) + bundler (>= 1.15.0) + railties (= 8.0.1) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -150,6 +225,8 @@ GEM rubocop (~> 1.61) rubocop-graphql (1.5.4) rubocop (>= 1.50, < 2) + rubocop-packaging (0.5.2) + rubocop (>= 1.33, < 2.0) rubocop-performance (1.23.0) rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) @@ -183,6 +260,7 @@ GEM rubocop-performance (~> 1.23.0) stringio (3.1.2) thor (1.3.2) + timeout (0.4.3) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (3.1.2) @@ -190,6 +268,9 @@ GEM unicode-emoji (4.0.4) uri (1.0.2) useragent (0.16.11) + websocket-driver (0.7.6) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) zeitwerk (2.7.1) PLATFORMS @@ -201,11 +282,12 @@ PLATFORMS DEPENDENCIES betterlint! - bundler pry - rake (>= 12.3.3) + rails (>= 6.1) + rake (>= 13) rspec-rails - standard + rubocop-packaging (~> 0.5, >= 0.5.2) + standard (>= 1.35.1, != 1.42.0, != 1.41.1) BUNDLED WITH 2.4.22 diff --git a/README.md b/README.md index 265df93..a1700b2 100644 --- a/README.md +++ b/README.md @@ -280,3 +280,15 @@ actions often indicates error handling (e.g. `422 Unprocessable Entity`). This cop requires you to explicitly provide an HTTP status code when rendering a response in the create, update, and destroy actions. When autocorrecting, this will automatically add `status: :unprocessable_entity` or `status: :ok` depending on what you're rendering. + +## Contributing + +### Appraisal + +Generate a new set of Appraisal gemfiles: + +```bash +BUNDLE_GEMFILE=appraisal_root.gemfile bundle update +BUNDLE_GEMFILE=appraisal_root.gemfile appraisal update +BUNDLE_GEMFILE=gemfiles/style.gemfile bundle exec rubocop -A --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment +``` diff --git a/appraisal_root.gemfile b/appraisal_root.gemfile new file mode 100644 index 0000000..1079614 --- /dev/null +++ b/appraisal_root.gemfile @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +# To update Appraisal-generated gemfiles/*.gemfile run: +# BUNDLE_GEMFILE=appraisal_root.gemfile bundle update +# BUNDLE_GEMFILE=appraisal_root.gemfile appraisal update +# BUNDLE_GEMFILE=gemfiles/style.gemfile bundle exec rubocop -A --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment + +git_source(:github) { |repo_name| "https://github.com/#{repo_name}" } + +source "https://rubygems.org" + +# Appraisal Root Gemfile is for running appraisal to generate the Appraisal Gemfiles +# in gemfiles/*gemfile. +# In GitHub Actions CI it is used to prepare the env to install an Appraisal gemfiles/*gemfile. +# +# Do not load the primary Gemfile for Appraisal Gemfiles generation, +# as it is tailored for local development, +# and includes things unrelated to running the spec suite. + +gemspec diff --git a/appraisal_root.gemfile.lock b/appraisal_root.gemfile.lock new file mode 100644 index 0000000..791374f --- /dev/null +++ b/appraisal_root.gemfile.lock @@ -0,0 +1,108 @@ +PATH + remote: . + specs: + betterlint (1.16.0) + rubocop (~> 1.62) + rubocop-graphql (~> 1.5) + rubocop-performance (~> 1.21) + rubocop-rails (~> 2.24) + rubocop-rake (~> 0.6) + rubocop-rspec (~> 2.28) + +GEM + remote: https://rubygems.org/ + specs: + activesupport (8.0.1) + base64 + benchmark (>= 0.3) + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + ast (2.4.2) + base64 (0.2.0) + benchmark (0.4.0) + bigdecimal (3.1.8) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) + drb (2.2.1) + i18n (1.14.6) + concurrent-ruby (~> 1.0) + json (2.9.1) + language_server-protocol (3.17.0.3) + logger (1.6.4) + minitest (5.25.4) + parallel (1.26.3) + parser (3.3.6.0) + ast (~> 2.4.1) + racc + racc (1.8.1) + rack (3.1.8) + rainbow (3.1.1) + rake (13.2.1) + regexp_parser (2.9.3) + rubocop (1.69.2) + json (~> 2.3) + language_server-protocol (>= 3.17.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.36.2, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.37.0) + parser (>= 3.3.1.0) + rubocop-capybara (2.21.0) + rubocop (~> 1.41) + rubocop-factory_bot (2.26.1) + rubocop (~> 1.61) + rubocop-graphql (1.5.4) + rubocop (>= 1.50, < 2) + rubocop-performance (1.23.0) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rails (2.27.0) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.52.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rake (0.6.0) + rubocop (~> 1.0) + rubocop-rspec (2.31.0) + rubocop (~> 1.40) + rubocop-capybara (~> 2.17) + rubocop-factory_bot (~> 2.22) + rubocop-rspec_rails (~> 2.28) + rubocop-rspec_rails (2.29.1) + rubocop (~> 1.61) + ruby-progressbar (1.13.0) + securerandom (0.4.1) + thor (1.3.2) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (3.1.2) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) + uri (1.0.2) + +PLATFORMS + arm64-darwin-24 + ruby + +DEPENDENCIES + appraisal (~> 2.5) + betterlint! + +BUNDLED WITH + 2.6.1 diff --git a/gemfiles/rails_6_1.gemfile b/gemfiles/rails_6_1.gemfile new file mode 100644 index 0000000..d736562 --- /dev/null +++ b/gemfiles/rails_6_1.gemfile @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "mutex_m", "~> 0.2" +gem "rails", "~> 6.1.7.10" +gem "stringio", "~> 3.0" + +gemspec path: "../" diff --git a/gemfiles/rails_7_0.gemfile b/gemfiles/rails_7_0.gemfile new file mode 100644 index 0000000..483c99a --- /dev/null +++ b/gemfiles/rails_7_0.gemfile @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "mutex_m", "~> 0.2" +gem "rails", "~> 7.0.8", ">= 7.0.8.7" +gem "stringio", "~> 3.0" + +gemspec path: "../" diff --git a/gemfiles/rails_7_1.gemfile b/gemfiles/rails_7_1.gemfile new file mode 100644 index 0000000..1367ce0 --- /dev/null +++ b/gemfiles/rails_7_1.gemfile @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "mutex_m", "~> 0.2" +gem "rails", "~> 7.1.5", ">= 7.1.5.1" +gem "stringio", "~> 3.0" + +gemspec path: "../" diff --git a/gemfiles/rails_7_2.gemfile b/gemfiles/rails_7_2.gemfile new file mode 100644 index 0000000..11b97fa --- /dev/null +++ b/gemfiles/rails_7_2.gemfile @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "mutex_m", "~> 0.2" +gem "rails", "~> 7.2.2", ">= 7.2.2.1" +gem "stringio", "~> 3.0" + +gemspec path: "../" diff --git a/gemfiles/rails_8_0.gemfile b/gemfiles/rails_8_0.gemfile new file mode 100644 index 0000000..23daa0d --- /dev/null +++ b/gemfiles/rails_8_0.gemfile @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "mutex_m", "~> 0.2" +gem "rails", "~> 8.0.1" +gem "stringio", "~> 3.0" + +gemspec path: "../" diff --git a/gemfiles/style.gemfile b/gemfiles/style.gemfile new file mode 100644 index 0000000..978fb30 --- /dev/null +++ b/gemfiles/style.gemfile @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "mutex_m", "~> 0.2" +gem "rails", ">= 6.1" +gem "rake", ">= 13" +gem "rubocop-packaging", "~> 0.5", ">= 0.5.2" +gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" +gem "stringio", "~> 3.0" + +gemspec path: "../" From f9d018d7a473446b7a4dff27b51e8f667483766a Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 14:45:45 -0700 Subject: [PATCH 07/19] =?UTF-8?q?=E2=9C=A8=20rubocop-packaging?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rubocop.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.rubocop.yml b/.rubocop.yml index 5061024..ec7b08e 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,6 +4,7 @@ inherit_from: require: - rubocop/cop/internal_affairs + - rubocop-packaging AllCops: NewCops: enable From 4f348789a711fa71aa649bc78f6fb127c996ef71 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 14:50:15 -0700 Subject: [PATCH 08/19] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Allow=20rubocop-rspe?= =?UTF-8?q?c=20v3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 13 ++----------- betterlint.gemspec | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 07235c8..2a1e399 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,7 +7,7 @@ PATH rubocop-performance (~> 1.21) rubocop-rails (~> 2.24) rubocop-rake (~> 0.6) - rubocop-rspec (~> 2.28) + rubocop-rspec (>= 2.28) GEM remote: https://rubygems.org/ @@ -219,10 +219,6 @@ GEM unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.37.0) parser (>= 3.3.1.0) - rubocop-capybara (2.21.0) - rubocop (~> 1.41) - rubocop-factory_bot (2.26.1) - rubocop (~> 1.61) rubocop-graphql (1.5.4) rubocop (>= 1.50, < 2) rubocop-packaging (0.5.2) @@ -237,12 +233,7 @@ GEM rubocop-ast (>= 1.31.1, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) - rubocop-rspec (2.31.0) - rubocop (~> 1.40) - rubocop-capybara (~> 2.17) - rubocop-factory_bot (~> 2.22) - rubocop-rspec_rails (~> 2.28) - rubocop-rspec_rails (2.29.1) + rubocop-rspec (3.3.0) rubocop (~> 1.61) ruby-progressbar (1.13.0) securerandom (0.4.1) diff --git a/betterlint.gemspec b/betterlint.gemspec index d22f73e..71f4be2 100644 --- a/betterlint.gemspec +++ b/betterlint.gemspec @@ -29,5 +29,5 @@ Gem::Specification.new do |s| s.add_dependency "rubocop-performance", "~> 1.21" s.add_dependency "rubocop-rails", "~> 2.24" s.add_dependency "rubocop-rake", "~> 0.6" - s.add_dependency "rubocop-rspec", "~> 2.28" + s.add_dependency "rubocop-rspec", ">= 2.28" end From bfaf295560cb7b59974cf2f51d8efe4cd5741bb2 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 14:57:31 -0700 Subject: [PATCH 09/19] =?UTF-8?q?=F0=9F=94=A5=20Remove=20truffleruby-head?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/heads.yml | 8 -------- Appraisals | 2 -- 2 files changed, 10 deletions(-) diff --git a/.github/workflows/heads.yml b/.github/workflows/heads.yml index d6d5b73..31d4282 100644 --- a/.github/workflows/heads.yml +++ b/.github/workflows/heads.yml @@ -21,14 +21,6 @@ jobs: rubygems: latest bundler: latest - # truffleruby-head - - ruby: "truffleruby-head" - appraisal: "rails-8-0" - taskname: "spec" - gemfile: "appraisal_root" - rubygems: latest - bundler: latest - steps: - name: Checkout uses: actions/checkout@v4 diff --git a/Appraisals b/Appraisals index 254c2f4..64949e5 100644 --- a/Appraisals +++ b/Appraisals @@ -68,8 +68,6 @@ end # + Ruby 3.2 # + Ruby 3.3 # + ruby-head -# + truffleruby-head -# - jruby-head appraise "rails-8-0" do gem "mutex_m", "~> 0.2" gem "rails", "~> 8.0.1" From cf889decc839a6fdca160a84eeaa318431c79e41 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 15:02:40 -0700 Subject: [PATCH 10/19] =?UTF-8?q?=F0=9F=91=B7=20Correct=20path=20to=20appr?= =?UTF-8?q?aisal=20gemfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/style.yml | 2 +- .github/workflows/tests.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 1ad2387..757e003 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -17,7 +17,7 @@ jobs: bundler: latest runs-on: ubuntu-latest env: # $BUNDLE_GEMFILE must be set at job level, so it is set for all steps - BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile + BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}.gemfile steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e3453d2..f68ab2e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,6 +4,8 @@ on: [push, pull_request] jobs: test: + env: # $BUNDLE_GEMFILE must be set at job level, so it is set for all steps + BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}.gemfile runs-on: ubuntu-latest strategy: fail-fast: false From 707b60383b6420c172be26890af15ff9e688316a Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 15:07:17 -0700 Subject: [PATCH 11/19] =?UTF-8?q?=E2=9E=95=20appraisal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- appraisal_root.gemfile | 2 ++ appraisal_root.gemfile.lock | 13 ++----------- gemfiles/rails_6_1.gemfile | 3 +-- gemfiles/rails_7_0.gemfile | 3 +-- gemfiles/rails_7_1.gemfile | 3 +-- gemfiles/rails_7_2.gemfile | 3 +-- gemfiles/rails_8_0.gemfile | 3 +-- gemfiles/style.gemfile | 3 +-- 8 files changed, 10 insertions(+), 23 deletions(-) diff --git a/appraisal_root.gemfile b/appraisal_root.gemfile index 1079614..a9b7b41 100644 --- a/appraisal_root.gemfile +++ b/appraisal_root.gemfile @@ -17,4 +17,6 @@ source "https://rubygems.org" # as it is tailored for local development, # and includes things unrelated to running the spec suite. +gem 'appraisal', '~> 2.5' + gemspec diff --git a/appraisal_root.gemfile.lock b/appraisal_root.gemfile.lock index 791374f..b31d38c 100644 --- a/appraisal_root.gemfile.lock +++ b/appraisal_root.gemfile.lock @@ -7,7 +7,7 @@ PATH rubocop-performance (~> 1.21) rubocop-rails (~> 2.24) rubocop-rake (~> 0.6) - rubocop-rspec (~> 2.28) + rubocop-rspec (>= 2.28) GEM remote: https://rubygems.org/ @@ -63,10 +63,6 @@ GEM unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.37.0) parser (>= 3.3.1.0) - rubocop-capybara (2.21.0) - rubocop (~> 1.41) - rubocop-factory_bot (2.26.1) - rubocop (~> 1.61) rubocop-graphql (1.5.4) rubocop (>= 1.50, < 2) rubocop-performance (1.23.0) @@ -79,12 +75,7 @@ GEM rubocop-ast (>= 1.31.1, < 2.0) rubocop-rake (0.6.0) rubocop (~> 1.0) - rubocop-rspec (2.31.0) - rubocop (~> 1.40) - rubocop-capybara (~> 2.17) - rubocop-factory_bot (~> 2.22) - rubocop-rspec_rails (~> 2.28) - rubocop-rspec_rails (2.29.1) + rubocop-rspec (3.3.0) rubocop (~> 1.61) ruby-progressbar (1.13.0) securerandom (0.4.1) diff --git a/gemfiles/rails_6_1.gemfile b/gemfiles/rails_6_1.gemfile index d736562..9b1ef6c 100644 --- a/gemfiles/rails_6_1.gemfile +++ b/gemfiles/rails_6_1.gemfile @@ -1,9 +1,8 @@ -# frozen_string_literal: true - # This file was generated by Appraisal source "https://rubygems.org" +gem "appraisal", "~> 2.5" gem "mutex_m", "~> 0.2" gem "rails", "~> 6.1.7.10" gem "stringio", "~> 3.0" diff --git a/gemfiles/rails_7_0.gemfile b/gemfiles/rails_7_0.gemfile index 483c99a..0f3d364 100644 --- a/gemfiles/rails_7_0.gemfile +++ b/gemfiles/rails_7_0.gemfile @@ -1,9 +1,8 @@ -# frozen_string_literal: true - # This file was generated by Appraisal source "https://rubygems.org" +gem "appraisal", "~> 2.5" gem "mutex_m", "~> 0.2" gem "rails", "~> 7.0.8", ">= 7.0.8.7" gem "stringio", "~> 3.0" diff --git a/gemfiles/rails_7_1.gemfile b/gemfiles/rails_7_1.gemfile index 1367ce0..7acda6a 100644 --- a/gemfiles/rails_7_1.gemfile +++ b/gemfiles/rails_7_1.gemfile @@ -1,9 +1,8 @@ -# frozen_string_literal: true - # This file was generated by Appraisal source "https://rubygems.org" +gem "appraisal", "~> 2.5" gem "mutex_m", "~> 0.2" gem "rails", "~> 7.1.5", ">= 7.1.5.1" gem "stringio", "~> 3.0" diff --git a/gemfiles/rails_7_2.gemfile b/gemfiles/rails_7_2.gemfile index 11b97fa..3d38e1f 100644 --- a/gemfiles/rails_7_2.gemfile +++ b/gemfiles/rails_7_2.gemfile @@ -1,9 +1,8 @@ -# frozen_string_literal: true - # This file was generated by Appraisal source "https://rubygems.org" +gem "appraisal", "~> 2.5" gem "mutex_m", "~> 0.2" gem "rails", "~> 7.2.2", ">= 7.2.2.1" gem "stringio", "~> 3.0" diff --git a/gemfiles/rails_8_0.gemfile b/gemfiles/rails_8_0.gemfile index 23daa0d..6db28b7 100644 --- a/gemfiles/rails_8_0.gemfile +++ b/gemfiles/rails_8_0.gemfile @@ -1,9 +1,8 @@ -# frozen_string_literal: true - # This file was generated by Appraisal source "https://rubygems.org" +gem "appraisal", "~> 2.5" gem "mutex_m", "~> 0.2" gem "rails", "~> 8.0.1" gem "stringio", "~> 3.0" diff --git a/gemfiles/style.gemfile b/gemfiles/style.gemfile index 978fb30..a280436 100644 --- a/gemfiles/style.gemfile +++ b/gemfiles/style.gemfile @@ -1,9 +1,8 @@ -# frozen_string_literal: true - # This file was generated by Appraisal source "https://rubygems.org" +gem "appraisal", "~> 2.5" gem "mutex_m", "~> 0.2" gem "rails", ">= 6.1" gem "rake", ">= 13" From 93dfc6365ac90de09a1ce91ca7603828d147afae Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 15:30:02 -0700 Subject: [PATCH 12/19] =?UTF-8?q?=E2=9E=95=20rubocop-capybara,=20rubocop-f?= =?UTF-8?q?actory=5Fbot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Error: The `RSpec/Capybara/FeatureMethods` cop has been removed since this cop has migrated to `RSpec/Dialect`. Please use `RSpec/Dialect` instead. (obsolete configuration found in config/default.yml, please update it) `RSpec/Capybara/*` has been extracted to the `rubocop-capybara` gem. (obsolete configuration found in config/default.yml, please update it) Error: unrecognized cop or department FactoryBot/AssociationStyle found in config/default.yml unrecognized cop or department FactoryBot/ConsistentParenthesesStyle found in config/default.yml unrecognized cop or department FactoryBot/SyntaxMethods found in config/default.yml --- Appraisals | 10 ++++++++++ appraisal_root.gemfile.lock | 6 ++++++ betterlint.gemspec | 2 ++ config/default.yml | 5 ++--- gemfiles/rails_6_1.gemfile | 4 ++++ gemfiles/rails_7_0.gemfile | 4 ++++ gemfiles/rails_7_1.gemfile | 4 ++++ gemfiles/rails_7_2.gemfile | 4 ++++ gemfiles/rails_8_0.gemfile | 4 ++++ gemfiles/style.gemfile | 2 ++ 10 files changed, 42 insertions(+), 3 deletions(-) diff --git a/Appraisals b/Appraisals index 64949e5..65421f3 100644 --- a/Appraisals +++ b/Appraisals @@ -26,6 +26,8 @@ end appraise "rails-6-1" do gem "mutex_m", "~> 0.2" gem "rails", "~> 6.1.7.10" + gem "rake", ">= 13" + gem "rspec-rails" gem "stringio", "~> 3.0" end @@ -37,6 +39,8 @@ end appraise "rails-7-0" do gem "mutex_m", "~> 0.2" gem "rails", "~> 7.0.8", ">= 7.0.8.7" + gem "rake", ">= 13" + gem "rspec-rails" gem "stringio", "~> 3.0" end @@ -49,6 +53,8 @@ end appraise "rails-7-1" do gem "mutex_m", "~> 0.2" gem "rails", "~> 7.1.5", ">= 7.1.5.1" + gem "rake", ">= 13" + gem "rspec-rails" gem "stringio", "~> 3.0" end @@ -60,6 +66,8 @@ end appraise "rails-7-2" do gem "mutex_m", "~> 0.2" gem "rails", "~> 7.2.2", ">= 7.2.2.1" + gem "rake", ">= 13" + gem "rspec-rails" gem "stringio", "~> 3.0" end @@ -71,5 +79,7 @@ end appraise "rails-8-0" do gem "mutex_m", "~> 0.2" gem "rails", "~> 8.0.1" + gem "rake", ">= 13" + gem "rspec-rails" gem "stringio", "~> 3.0" end diff --git a/appraisal_root.gemfile.lock b/appraisal_root.gemfile.lock index b31d38c..9473c64 100644 --- a/appraisal_root.gemfile.lock +++ b/appraisal_root.gemfile.lock @@ -3,6 +3,8 @@ PATH specs: betterlint (1.16.0) rubocop (~> 1.62) + rubocop-capybara (~> 2.21) + rubocop-factory_bot (~> 2.26) rubocop-graphql (~> 1.5) rubocop-performance (~> 1.21) rubocop-rails (~> 2.24) @@ -63,6 +65,10 @@ GEM unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.37.0) parser (>= 3.3.1.0) + rubocop-capybara (2.21.0) + rubocop (~> 1.41) + rubocop-factory_bot (2.26.1) + rubocop (~> 1.61) rubocop-graphql (1.5.4) rubocop (>= 1.50, < 2) rubocop-performance (1.23.0) diff --git a/betterlint.gemspec b/betterlint.gemspec index 71f4be2..8421f88 100644 --- a/betterlint.gemspec +++ b/betterlint.gemspec @@ -30,4 +30,6 @@ Gem::Specification.new do |s| s.add_dependency "rubocop-rails", "~> 2.24" s.add_dependency "rubocop-rake", "~> 0.6" s.add_dependency "rubocop-rspec", ">= 2.28" + s.add_dependency "rubocop-capybara", "~> 2.21" + s.add_dependency "rubocop-factory_bot", "~> 2.26" end diff --git a/config/default.yml b/config/default.yml index c2489d6..eae7e4c 100644 --- a/config/default.yml +++ b/config/default.yml @@ -2,6 +2,8 @@ require: - rubocop/cop/betterment.rb + - rubocop-capybara + - rubocop-factory_bot - rubocop-graphql - rubocop-performance - rubocop-rails @@ -239,9 +241,6 @@ Performance/RedundantMatch: RSpec/BeEq: Enabled: false -RSpec/Capybara/FeatureMethods: - Enabled: false - RSpec/ContextWording: Enabled: false diff --git a/gemfiles/rails_6_1.gemfile b/gemfiles/rails_6_1.gemfile index 9b1ef6c..b03fc23 100644 --- a/gemfiles/rails_6_1.gemfile +++ b/gemfiles/rails_6_1.gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file was generated by Appraisal source "https://rubygems.org" @@ -5,6 +7,8 @@ source "https://rubygems.org" gem "appraisal", "~> 2.5" gem "mutex_m", "~> 0.2" gem "rails", "~> 6.1.7.10" +gem "rake", ">= 13" +gem "rspec-rails" gem "stringio", "~> 3.0" gemspec path: "../" diff --git a/gemfiles/rails_7_0.gemfile b/gemfiles/rails_7_0.gemfile index 0f3d364..8ca127d 100644 --- a/gemfiles/rails_7_0.gemfile +++ b/gemfiles/rails_7_0.gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file was generated by Appraisal source "https://rubygems.org" @@ -5,6 +7,8 @@ source "https://rubygems.org" gem "appraisal", "~> 2.5" gem "mutex_m", "~> 0.2" gem "rails", "~> 7.0.8", ">= 7.0.8.7" +gem "rake", ">= 13" +gem "rspec-rails" gem "stringio", "~> 3.0" gemspec path: "../" diff --git a/gemfiles/rails_7_1.gemfile b/gemfiles/rails_7_1.gemfile index 7acda6a..afcd3cf 100644 --- a/gemfiles/rails_7_1.gemfile +++ b/gemfiles/rails_7_1.gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file was generated by Appraisal source "https://rubygems.org" @@ -5,6 +7,8 @@ source "https://rubygems.org" gem "appraisal", "~> 2.5" gem "mutex_m", "~> 0.2" gem "rails", "~> 7.1.5", ">= 7.1.5.1" +gem "rake", ">= 13" +gem "rspec-rails" gem "stringio", "~> 3.0" gemspec path: "../" diff --git a/gemfiles/rails_7_2.gemfile b/gemfiles/rails_7_2.gemfile index 3d38e1f..e868200 100644 --- a/gemfiles/rails_7_2.gemfile +++ b/gemfiles/rails_7_2.gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file was generated by Appraisal source "https://rubygems.org" @@ -5,6 +7,8 @@ source "https://rubygems.org" gem "appraisal", "~> 2.5" gem "mutex_m", "~> 0.2" gem "rails", "~> 7.2.2", ">= 7.2.2.1" +gem "rake", ">= 13" +gem "rspec-rails" gem "stringio", "~> 3.0" gemspec path: "../" diff --git a/gemfiles/rails_8_0.gemfile b/gemfiles/rails_8_0.gemfile index 6db28b7..f8d2348 100644 --- a/gemfiles/rails_8_0.gemfile +++ b/gemfiles/rails_8_0.gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file was generated by Appraisal source "https://rubygems.org" @@ -5,6 +7,8 @@ source "https://rubygems.org" gem "appraisal", "~> 2.5" gem "mutex_m", "~> 0.2" gem "rails", "~> 8.0.1" +gem "rake", ">= 13" +gem "rspec-rails" gem "stringio", "~> 3.0" gemspec path: "../" diff --git a/gemfiles/style.gemfile b/gemfiles/style.gemfile index a280436..19d1aa4 100644 --- a/gemfiles/style.gemfile +++ b/gemfiles/style.gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file was generated by Appraisal source "https://rubygems.org" From 3cc978a2f3901b5196f7ea55f6c92203fdd3788f Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 15:34:33 -0700 Subject: [PATCH 13/19] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Rakefile=20for=20sce?= =?UTF-8?q?narios=20without=20RuboCop=20/=20RSpec=20(e.g.=20on=20CI)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Rakefile | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/Rakefile b/Rakefile index b0a9082..da61780 100644 --- a/Rakefile +++ b/Rakefile @@ -1,18 +1,24 @@ # frozen_string_literal: true +require "bundler/gem_tasks" + begin - require 'bundler/setup' + require 'rubocop/rake_task' + RuboCop::RakeTask.new rescue LoadError - puts 'You must `gem install bundler` and `bundle install` to run rake tasks' + task(:rubocop) do + warn("RuboCop is disabled") + end end -Bundler::GemHelper.install_tasks - -require 'rubocop/rake_task' -RuboCop::RakeTask.new - -require 'rspec/core' -require 'rspec/core/rake_task' -RSpec::Core::RakeTask.new(:spec) +begin + require 'rspec/core' + require 'rspec/core/rake_task' + RSpec::Core::RakeTask.new(:spec) +rescue LoadError + task(:spec) do + warn("RSpec is disabled") + end +end task default: %i(rubocop spec) From 2b26b8b60e0ee97eef34b6f5e56a3024ea1ea6c8 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 15:45:15 -0700 Subject: [PATCH 14/19] =?UTF-8?q?=E2=9E=95=20rubocop,=20rspec=20@=20latest?= =?UTF-8?q?=20release=20for=20local=20dev?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 ++ Gemfile.lock | 12 ++++++++++++ Rakefile | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index d504260..904b954 100644 --- a/Gemfile +++ b/Gemfile @@ -6,8 +6,10 @@ gemspec # See: `appraisal_root.gemfile` gem 'rails', '>= 6.1' gem 'pry' +gem 'rspec', '~> 3.13' gem 'rspec-rails' gem 'rake', '>= 13' +gem 'rubocop', '~> 1.69', '>= 1.69.2' gem 'rubocop-packaging', '~> 0.5', '>= 0.5.2' # Skip some bad releases of standard gem 'standard', '>= 1.35.1', '!= 1.41.1', '!= 1.42.0' diff --git a/Gemfile.lock b/Gemfile.lock index 2a1e399..d97a4ee 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,6 +3,8 @@ PATH specs: betterlint (1.16.0) rubocop (~> 1.62) + rubocop-capybara (~> 2.21) + rubocop-factory_bot (~> 2.26) rubocop-graphql (~> 1.5) rubocop-performance (~> 1.21) rubocop-rails (~> 2.24) @@ -190,6 +192,10 @@ GEM regexp_parser (2.9.3) reline (0.6.0) io-console (~> 0.5) + rspec (3.13.0) + rspec-core (~> 3.13.0) + rspec-expectations (~> 3.13.0) + rspec-mocks (~> 3.13.0) rspec-core (3.13.2) rspec-support (~> 3.13.0) rspec-expectations (3.13.3) @@ -219,6 +225,10 @@ GEM unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.37.0) parser (>= 3.3.1.0) + rubocop-capybara (2.21.0) + rubocop (~> 1.41) + rubocop-factory_bot (2.26.1) + rubocop (~> 1.61) rubocop-graphql (1.5.4) rubocop (>= 1.50, < 2) rubocop-packaging (0.5.2) @@ -276,7 +286,9 @@ DEPENDENCIES pry rails (>= 6.1) rake (>= 13) + rspec (~> 3.13) rspec-rails + rubocop (~> 1.69, >= 1.69.2) rubocop-packaging (~> 0.5, >= 0.5.2) standard (>= 1.35.1, != 1.42.0, != 1.41.1) diff --git a/Rakefile b/Rakefile index da61780..00072ad 100644 --- a/Rakefile +++ b/Rakefile @@ -4,6 +4,7 @@ require "bundler/gem_tasks" begin require 'rubocop/rake_task' + RuboCop::RakeTask.new rescue LoadError task(:rubocop) do @@ -12,8 +13,8 @@ rescue LoadError end begin - require 'rspec/core' require 'rspec/core/rake_task' + RSpec::Core::RakeTask.new(:spec) rescue LoadError task(:spec) do From 5ed5a5e7d4597b60f84bdbcfde32acc10b536167 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 15:47:21 -0700 Subject: [PATCH 15/19] =?UTF-8?q?=F0=9F=91=B7=20Never=20load=20pry=20on=20?= =?UTF-8?q?CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/spec_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9257147..6291be9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -4,7 +4,7 @@ require 'rubocop/cop/betterment' require 'rubocop/rspec/support' require 'support/betterlint_config' -require 'pry' +require 'pry' unless ENV.fetch('CI', 'false').casecmp?('true') RSpec.configure do |config| config.include RuboCop::RSpec::ExpectOffense From faacb80e5af41f585d8316a4c2443504c71390fd Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 16:29:02 -0700 Subject: [PATCH 16/19] =?UTF-8?q?=F0=9F=9A=A8=20Disable=20Rails/RakeEnviro?= =?UTF-8?q?nment=20as=20gem=20isn't=20a=20Rails=20app?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rubocop.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.rubocop.yml b/.rubocop.yml index ec7b08e..2f864f6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -9,3 +9,6 @@ require: AllCops: NewCops: enable TargetRubyVersion: 3.0 + +Rails/RakeEnvironment: + Enabled: false From 8a355a97f43d176dd7f308548049f62feb71845d Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 16:36:51 -0700 Subject: [PATCH 17/19] =?UTF-8?q?=E2=9E=95=20rubocop,=20standard=20require?= =?UTF-8?q?d=20for=20specs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Appraisals | 16 ++++++++++++++++ README.md | 10 ++++++++++ betterlint.gemspec | 4 ++-- gemfiles/rails_6_1.gemfile | 2 ++ gemfiles/rails_7_0.gemfile | 2 ++ gemfiles/rails_7_1.gemfile | 2 ++ gemfiles/rails_7_2.gemfile | 2 ++ gemfiles/rails_8_0.gemfile | 2 ++ gemfiles/style.gemfile | 1 + 9 files changed, 39 insertions(+), 2 deletions(-) diff --git a/Appraisals b/Appraisals index 65421f3..07be10a 100644 --- a/Appraisals +++ b/Appraisals @@ -11,6 +11,7 @@ appraise "style" do gem "mutex_m", "~> 0.2" gem "rails", ">= 6.1" gem "rake", ">= 13" + gem "rubocop", "~> 1.69", ">= 1.69.2" gem "rubocop-packaging", "~> 0.5", ">= 0.5.2" # Skip some bad releases of standard gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" @@ -28,6 +29,9 @@ appraise "rails-6-1" do gem "rails", "~> 6.1.7.10" gem "rake", ">= 13" gem "rspec-rails" + gem "rubocop", "~> 1.69", ">= 1.69.2" + # Skip some bad releases of standard + gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" gem "stringio", "~> 3.0" end @@ -41,6 +45,9 @@ appraise "rails-7-0" do gem "rails", "~> 7.0.8", ">= 7.0.8.7" gem "rake", ">= 13" gem "rspec-rails" + gem "rubocop", "~> 1.69", ">= 1.69.2" + # Skip some bad releases of standard + gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" gem "stringio", "~> 3.0" end @@ -55,6 +62,9 @@ appraise "rails-7-1" do gem "rails", "~> 7.1.5", ">= 7.1.5.1" gem "rake", ">= 13" gem "rspec-rails" + gem "rubocop", "~> 1.69", ">= 1.69.2" + # Skip some bad releases of standard + gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" gem "stringio", "~> 3.0" end @@ -68,6 +78,9 @@ appraise "rails-7-2" do gem "rails", "~> 7.2.2", ">= 7.2.2.1" gem "rake", ">= 13" gem "rspec-rails" + gem "rubocop", "~> 1.69", ">= 1.69.2" + # Skip some bad releases of standard + gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" gem "stringio", "~> 3.0" end @@ -81,5 +94,8 @@ appraise "rails-8-0" do gem "rails", "~> 8.0.1" gem "rake", ">= 13" gem "rspec-rails" + gem "rubocop", "~> 1.69", ">= 1.69.2" + # Skip some bad releases of standard + gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" gem "stringio", "~> 3.0" end diff --git a/README.md b/README.md index a1700b2..445f6c5 100644 --- a/README.md +++ b/README.md @@ -292,3 +292,13 @@ BUNDLE_GEMFILE=appraisal_root.gemfile bundle update BUNDLE_GEMFILE=appraisal_root.gemfile appraisal update BUNDLE_GEMFILE=gemfiles/style.gemfile bundle exec rubocop -A --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment ``` + +### Reproduce CI test failure + +Example: A test fails in the workflow for `rails-8-0`. + +You want to reproduce it similar to how it runs on CI: + +```shell +CI=true BUNDLE_GEMFILE=appraisal_root.gemfile appraisal "rails-8-0" bundle exec rake spec +``` diff --git a/betterlint.gemspec b/betterlint.gemspec index 8421f88..05a8c9e 100644 --- a/betterlint.gemspec +++ b/betterlint.gemspec @@ -25,11 +25,11 @@ Gem::Specification.new do |s| s.required_ruby_version = ">= 3.0" s.add_dependency "rubocop", "~> 1.62" + s.add_dependency "rubocop-capybara", "~> 2.21" + s.add_dependency "rubocop-factory_bot", "~> 2.26" s.add_dependency "rubocop-graphql", "~> 1.5" s.add_dependency "rubocop-performance", "~> 1.21" s.add_dependency "rubocop-rails", "~> 2.24" s.add_dependency "rubocop-rake", "~> 0.6" s.add_dependency "rubocop-rspec", ">= 2.28" - s.add_dependency "rubocop-capybara", "~> 2.21" - s.add_dependency "rubocop-factory_bot", "~> 2.26" end diff --git a/gemfiles/rails_6_1.gemfile b/gemfiles/rails_6_1.gemfile index b03fc23..f30d007 100644 --- a/gemfiles/rails_6_1.gemfile +++ b/gemfiles/rails_6_1.gemfile @@ -9,6 +9,8 @@ gem "mutex_m", "~> 0.2" gem "rails", "~> 6.1.7.10" gem "rake", ">= 13" gem "rspec-rails" +gem "rubocop", "~> 1.69", ">= 1.69.2" +gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" gem "stringio", "~> 3.0" gemspec path: "../" diff --git a/gemfiles/rails_7_0.gemfile b/gemfiles/rails_7_0.gemfile index 8ca127d..fd614d9 100644 --- a/gemfiles/rails_7_0.gemfile +++ b/gemfiles/rails_7_0.gemfile @@ -9,6 +9,8 @@ gem "mutex_m", "~> 0.2" gem "rails", "~> 7.0.8", ">= 7.0.8.7" gem "rake", ">= 13" gem "rspec-rails" +gem "rubocop", "~> 1.69", ">= 1.69.2" +gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" gem "stringio", "~> 3.0" gemspec path: "../" diff --git a/gemfiles/rails_7_1.gemfile b/gemfiles/rails_7_1.gemfile index afcd3cf..27e610f 100644 --- a/gemfiles/rails_7_1.gemfile +++ b/gemfiles/rails_7_1.gemfile @@ -9,6 +9,8 @@ gem "mutex_m", "~> 0.2" gem "rails", "~> 7.1.5", ">= 7.1.5.1" gem "rake", ">= 13" gem "rspec-rails" +gem "rubocop", "~> 1.69", ">= 1.69.2" +gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" gem "stringio", "~> 3.0" gemspec path: "../" diff --git a/gemfiles/rails_7_2.gemfile b/gemfiles/rails_7_2.gemfile index e868200..90b51d6 100644 --- a/gemfiles/rails_7_2.gemfile +++ b/gemfiles/rails_7_2.gemfile @@ -9,6 +9,8 @@ gem "mutex_m", "~> 0.2" gem "rails", "~> 7.2.2", ">= 7.2.2.1" gem "rake", ">= 13" gem "rspec-rails" +gem "rubocop", "~> 1.69", ">= 1.69.2" +gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" gem "stringio", "~> 3.0" gemspec path: "../" diff --git a/gemfiles/rails_8_0.gemfile b/gemfiles/rails_8_0.gemfile index f8d2348..1a58bc5 100644 --- a/gemfiles/rails_8_0.gemfile +++ b/gemfiles/rails_8_0.gemfile @@ -9,6 +9,8 @@ gem "mutex_m", "~> 0.2" gem "rails", "~> 8.0.1" gem "rake", ">= 13" gem "rspec-rails" +gem "rubocop", "~> 1.69", ">= 1.69.2" +gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" gem "stringio", "~> 3.0" gemspec path: "../" diff --git a/gemfiles/style.gemfile b/gemfiles/style.gemfile index 19d1aa4..52eee03 100644 --- a/gemfiles/style.gemfile +++ b/gemfiles/style.gemfile @@ -8,6 +8,7 @@ gem "appraisal", "~> 2.5" gem "mutex_m", "~> 0.2" gem "rails", ">= 6.1" gem "rake", ">= 13" +gem "rubocop", "~> 1.69", ">= 1.69.2" gem "rubocop-packaging", "~> 0.5", ">= 0.5.2" gem "standard", ">= 1.35.1", "!= 1.41.1", "!= 1.42.0" gem "stringio", "~> 3.0" From d4fa636d51a278e6c41285534dcf18804d5624ae Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 17:58:20 -0700 Subject: [PATCH 18/19] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Prefer=20YAML.safe?= =?UTF-8?q?=5Fload=5Ffile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/standard_compliance_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/standard_compliance_spec.rb b/spec/standard_compliance_spec.rb index 8e3d18b..73f2e2c 100644 --- a/spec/standard_compliance_spec.rb +++ b/spec/standard_compliance_spec.rb @@ -36,7 +36,7 @@ let(:default_config) do root = Gem.loaded_specs['rubocop'].full_gem_path path = File.expand_path('config/default.yml', root) - config = YAML.load_file(path, permitted_classes: [Regexp, Symbol]) + config = YAML.safe_load_file(path, permitted_classes: [Regexp, Symbol]) config.delete('AllCops') config end @@ -44,11 +44,11 @@ let(:standard_config) do root = Gem.loaded_specs['standard'].full_gem_path path = File.expand_path('config/base.yml', root) - YAML.load_file(path) + YAML.safe_load_file(path) end let(:betterlint_config) do - YAML.load_file('config/default.yml') + YAML.safe_load_file('config/default.yml') end it 'complies with standardrb with notable exceptions' do From dca21a64a95b0f47ae42f248e0e51a47f893c380 Mon Sep 17 00:00:00 2001 From: Peter Boling Date: Fri, 20 Dec 2024 18:16:11 -0700 Subject: [PATCH 19/19] =?UTF-8?q?=E2=9E=96=20rubocop-capybara?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile.lock | 3 --- appraisal_root.gemfile.lock | 3 --- betterlint.gemspec | 1 - config/default.yml | 1 - 4 files changed, 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d97a4ee..56a7e8c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,6 @@ PATH specs: betterlint (1.16.0) rubocop (~> 1.62) - rubocop-capybara (~> 2.21) rubocop-factory_bot (~> 2.26) rubocop-graphql (~> 1.5) rubocop-performance (~> 1.21) @@ -225,8 +224,6 @@ GEM unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.37.0) parser (>= 3.3.1.0) - rubocop-capybara (2.21.0) - rubocop (~> 1.41) rubocop-factory_bot (2.26.1) rubocop (~> 1.61) rubocop-graphql (1.5.4) diff --git a/appraisal_root.gemfile.lock b/appraisal_root.gemfile.lock index 9473c64..ec1d06f 100644 --- a/appraisal_root.gemfile.lock +++ b/appraisal_root.gemfile.lock @@ -3,7 +3,6 @@ PATH specs: betterlint (1.16.0) rubocop (~> 1.62) - rubocop-capybara (~> 2.21) rubocop-factory_bot (~> 2.26) rubocop-graphql (~> 1.5) rubocop-performance (~> 1.21) @@ -65,8 +64,6 @@ GEM unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.37.0) parser (>= 3.3.1.0) - rubocop-capybara (2.21.0) - rubocop (~> 1.41) rubocop-factory_bot (2.26.1) rubocop (~> 1.61) rubocop-graphql (1.5.4) diff --git a/betterlint.gemspec b/betterlint.gemspec index 05a8c9e..bb4a53d 100644 --- a/betterlint.gemspec +++ b/betterlint.gemspec @@ -25,7 +25,6 @@ Gem::Specification.new do |s| s.required_ruby_version = ">= 3.0" s.add_dependency "rubocop", "~> 1.62" - s.add_dependency "rubocop-capybara", "~> 2.21" s.add_dependency "rubocop-factory_bot", "~> 2.26" s.add_dependency "rubocop-graphql", "~> 1.5" s.add_dependency "rubocop-performance", "~> 1.21" diff --git a/config/default.yml b/config/default.yml index eae7e4c..0f85969 100644 --- a/config/default.yml +++ b/config/default.yml @@ -2,7 +2,6 @@ require: - rubocop/cop/betterment.rb - - rubocop-capybara - rubocop-factory_bot - rubocop-graphql - rubocop-performance