From 2ca72a3a2ebe23ee895f00836fae38b4a9cfaad2 Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 13:42:17 +0100 Subject: [PATCH 01/16] Add GitHub Action for RuboCop. --- .github/workflows/rubocop.yml | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/rubocop.yml diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml new file mode 100644 index 0000000..1118b16 --- /dev/null +++ b/.github/workflows/rubocop.yml @@ -0,0 +1,39 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake +# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby + +name: RuboCop + +on: + workflow_dispatch: + push: + branches: [ "main", "dev/ci" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + test: + + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['2.7', '3.0', '3.2'] + + steps: + - uses: actions/checkout@v3 + - name: Set up Ruby + # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, + # change this to (see https://github.com/ruby/setup-ruby#versioning): + # uses: ruby/setup-ruby@v1 + uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run RuboCop + run: bundle exec rubocop From 86a95a8ae2d2b87ae98fd6097086cbe091e212c6 Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 13:43:39 +0100 Subject: [PATCH 02/16] Use only Ruby 2.7. --- .github/workflows/rubocop.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 1118b16..725b83d 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -23,7 +23,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['2.7', '3.0', '3.2'] + # ruby-version: ['2.7', '3.0', '3.2'] + ruby-version: ['2.7'] steps: - uses: actions/checkout@v3 From f4902ae66728b445945e46e0f036c12819ddbb1a Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 13:55:36 +0100 Subject: [PATCH 03/16] Disable new cops. --- .rubocop.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.rubocop.yml b/.rubocop.yml index 806bf6a..8961602 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,6 +5,7 @@ require: - rubocop-sketchup AllCops: + NewCops: disable DisabledByDefault: true # TODO: Reenable DisplayStyleGuide: true SuggestExtensions: false From b0a3848ec591c3879a3254b87a4a093d87c10143 Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 14:00:13 +0100 Subject: [PATCH 04/16] Change ruby/setup-ruby action to v1. --- .github/workflows/rubocop.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 725b83d..1d13b31 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -31,8 +31,8 @@ jobs: - name: Set up Ruby # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, # change this to (see https://github.com/ruby/setup-ruby#versioning): - # uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0 + uses: ruby/setup-ruby@v1 + # uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0 with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically From b774fcfa9cd92631fdbba87cadecbfbbe9cdf0d9 Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 14:05:16 +0100 Subject: [PATCH 05/16] Try to use macos-latest instead of ubuntu-latest. --- .github/workflows/rubocop.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 1d13b31..a67173e 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -20,7 +20,8 @@ permissions: jobs: test: - runs-on: ubuntu-latest + # runs-on: ubuntu-latest + runs-on: macos-latest strategy: matrix: # ruby-version: ['2.7', '3.0', '3.2'] From 9b41fe5b9f640b057c5f572453c9c17d0337a74a Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 14:19:44 +0100 Subject: [PATCH 06/16] Dump RuboCop version. --- .github/workflows/rubocop.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index a67173e..051d978 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -37,5 +37,6 @@ jobs: with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - run: bundle exec rubocop -V - name: Run RuboCop run: bundle exec rubocop From 13b47bd487b99884fffd31aa3ef6a638b52cc2b5 Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 14:23:01 +0100 Subject: [PATCH 07/16] Run RuboCop in debug mode. --- .github/workflows/rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 051d978..bf840f9 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -39,4 +39,4 @@ jobs: bundler-cache: true # runs 'bundle install' and caches installed gems automatically - run: bundle exec rubocop -V - name: Run RuboCop - run: bundle exec rubocop + run: bundle exec rubocop --debug From cbd9ae79a1772c8ba1bfc3cbaa988dc9eaac4ed5 Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 17:07:19 +0100 Subject: [PATCH 08/16] Test with Ruby 3.1 and minimal Gemfile for RuboCop only. --- .github/workflows/rubocop.yml | 5 +++-- Gemfile | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index bf840f9..3acdfd9 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -10,7 +10,7 @@ name: RuboCop on: workflow_dispatch: push: - branches: [ "main", "dev/ci" ] + branches: [ "main", "dev/ci", "dev/ci-test" ] pull_request: branches: [ "main" ] @@ -25,7 +25,8 @@ jobs: strategy: matrix: # ruby-version: ['2.7', '3.0', '3.2'] - ruby-version: ['2.7'] + ruby-version: ['3.1'] + # ruby-version: ['2.7'] steps: - uses: actions/checkout@v3 diff --git a/Gemfile b/Gemfile index 2c7589d..1a26d6e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,14 +1,17 @@ source 'https://rubygems.org' -group :development do - gem 'colorize', '~> 0.8.1' - gem 'minitest', '5.4.3' - gem 'minitest-reporters-json_reporter' +# group :development do +# gem 'colorize', '~> 0.8.1' +# gem 'minitest', '5.4.3' +# gem 'minitest-reporters-json_reporter' +# gem 'rubyzip', '~> 1.2' +# gem 'sketchup-api-stubs' +# gem 'skippy', '~> 0.5.1.a' +# gem 'solargraph' +# end + +group :analytics do gem 'rubocop', '>= 0.82', '< 2.0' gem 'rubocop-sketchup', '~> 1.3.0' gem 'rubocop-performance', '~> 1.15.0' - gem 'rubyzip', '~> 1.2' - gem 'sketchup-api-stubs' - gem 'skippy', '~> 0.5.1.a' - gem 'solargraph' end From 1e09049e2920a65ae70438d706884bb913d7f348 Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 17:11:27 +0100 Subject: [PATCH 09/16] Exclude Bundler vendor folder. --- .gitignore | 1 + .rubocop.yml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index 4a47559..0105887 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ /archive/ /build/ /tests_old/ +/vendor/ Debug*/ Release*/ ipch/ diff --git a/.rubocop.yml b/.rubocop.yml index 8961602..88770c7 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -18,18 +18,21 @@ AllCops: - skippy/**/* - tests/**/* - tools/**/* + - vendor/**/* SketchupRequirements: Exclude: - ruby-c-extension/**/* - skippy/**/* - tests/**/* - tools/**/* + - vendor/**/* SketchupSuggestions: Exclude: - ruby-c-extension/**/* - skippy/**/* - tests/**/* - tools/**/* + - vendor/**/* TargetRubyVersion: 2.0 Exclude: - archive/**/* @@ -41,6 +44,7 @@ AllCops: - src/testup/third-party/**/*.rb - tests/**/*.rb # TODO - for now ignore. - tools/**/*.rb + - vendor/**/*.rb SketchupDeprecations: Enabled: true From 152950ee204ad86d85e476242307577211f20cb1 Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 17:11:47 +0100 Subject: [PATCH 10/16] Switch back to Ubuntu. --- .github/workflows/rubocop.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 3acdfd9..0740e8a 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -20,8 +20,8 @@ permissions: jobs: test: - # runs-on: ubuntu-latest - runs-on: macos-latest + runs-on: ubuntu-latest + # runs-on: macos-latest strategy: matrix: # ruby-version: ['2.7', '3.0', '3.2'] From 6b441bf9444d5bf035dfe7db9b4b18f55305ef93 Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 17:14:55 +0100 Subject: [PATCH 11/16] Try with Ruby 2.7 and 3.2. --- .github/workflows/rubocop.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 0740e8a..39b9780 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -25,8 +25,7 @@ jobs: strategy: matrix: # ruby-version: ['2.7', '3.0', '3.2'] - ruby-version: ['3.1'] - # ruby-version: ['2.7'] + ruby-version: ['2.7', '3.2'] steps: - uses: actions/checkout@v3 From 882aac1b78880f0c228c84466f82b90a2a702289 Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 17:24:47 +0100 Subject: [PATCH 12/16] Cleanups. --- .github/workflows/rubocop.yml | 19 ++++--------------- Gemfile | 24 +++++++++++++++--------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 39b9780..4e51ad2 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -1,10 +1,3 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. -# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake -# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby - name: RuboCop on: @@ -18,25 +11,21 @@ permissions: contents: read jobs: - test: + analysis: runs-on: ubuntu-latest - # runs-on: macos-latest strategy: matrix: - # ruby-version: ['2.7', '3.0', '3.2'] ruby-version: ['2.7', '3.2'] steps: - uses: actions/checkout@v3 - name: Set up Ruby - # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, - # change this to (see https://github.com/ruby/setup-ruby#versioning): uses: ruby/setup-ruby@v1 - # uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0 with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - run: bundle exec rubocop -V + - name: RuboCop version information + run: bundle exec rubocop -V - name: Run RuboCop - run: bundle exec rubocop --debug + run: bundle exec rubocop diff --git a/Gemfile b/Gemfile index 1a26d6e..ff07259 100644 --- a/Gemfile +++ b/Gemfile @@ -1,14 +1,20 @@ source 'https://rubygems.org' -# group :development do -# gem 'colorize', '~> 0.8.1' -# gem 'minitest', '5.4.3' -# gem 'minitest-reporters-json_reporter' -# gem 'rubyzip', '~> 1.2' -# gem 'sketchup-api-stubs' -# gem 'skippy', '~> 0.5.1.a' -# gem 'solargraph' -# end +# Even if you configure Bundler to install only one group it will fail if any +# of the unused groups have dependencies that cannot be resolved. +# On Ruby 3.2 the Minitest 5.4.3 will fail, so applying this kludge to work +# around that until Minitest is updated. +CI_BUILD = ENV['ci'] + +group :development do + gem 'colorize', '~> 0.8.1' + gem 'minitest', '5.4.3' + gem 'minitest-reporters-json_reporter' + gem 'rubyzip', '~> 1.2' + gem 'sketchup-api-stubs' + gem 'skippy', '~> 0.5.1.a' + gem 'solargraph' +end unless CI_BUILD group :analytics do gem 'rubocop', '>= 0.82', '< 2.0' From fbac9c9b2b306def3044948e13246cd92796b2f3 Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 17:29:01 +0100 Subject: [PATCH 13/16] Fix CI environment variable. --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index ff07259..122e94d 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source 'https://rubygems.org' # of the unused groups have dependencies that cannot be resolved. # On Ruby 3.2 the Minitest 5.4.3 will fail, so applying this kludge to work # around that until Minitest is updated. -CI_BUILD = ENV['ci'] +CI_BUILD = ENV['CI'] group :development do gem 'colorize', '~> 0.8.1' From a5760d8bea53ccd851172ceb4be31172d698141e Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 17:34:36 +0100 Subject: [PATCH 14/16] Fix RuboCop warnings. --- .rubocop.yml | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 88770c7..372aea9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -12,27 +12,13 @@ AllCops: SketchUp: SourcePath: src TargetSketchUpVersion: 2014 - SketchupPerformance: - Exclude: - - ruby-c-extension/**/* - - skippy/**/* - - tests/**/* - - tools/**/* - - vendor/**/* - SketchupRequirements: - Exclude: - - ruby-c-extension/**/* - - skippy/**/* - - tests/**/* - - tools/**/* - - vendor/**/* - SketchupSuggestions: - Exclude: - - ruby-c-extension/**/* - - skippy/**/* - - tests/**/* - - tools/**/* - - vendor/**/* + Exclude: + - Gemfile + - ruby-c-extension/**/* + - skippy/**/* + - tests/**/* + - tools/**/* + - vendor/**/* TargetRubyVersion: 2.0 Exclude: - archive/**/* @@ -188,6 +174,7 @@ Style/IfUnlessModifier: Style/MultilineIfModifier: Exclude: + - Gemfile - src/testup/file_reporter.rb - src/testup/ui.rb - src/testup/ui/adapters/htmldialog.rb From 43d68dbb4c1a6696f31ca4b0017c1419167b9172 Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 17:36:01 +0100 Subject: [PATCH 15/16] fix --- .github/workflows/rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index 4e51ad2..d2e6c37 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -3,7 +3,7 @@ name: RuboCop on: workflow_dispatch: push: - branches: [ "main", "dev/ci", "dev/ci-test" ] + branches: [ "main", "dev/ci" ] pull_request: branches: [ "main" ] From 77e76f02fd3cf174aa2647f385004d3b9890bef2 Mon Sep 17 00:00:00 2001 From: Thomas Thomassen Date: Wed, 3 Jan 2024 17:36:20 +0100 Subject: [PATCH 16/16] fix --- .github/workflows/rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rubocop.yml b/.github/workflows/rubocop.yml index d2e6c37..39f5708 100644 --- a/.github/workflows/rubocop.yml +++ b/.github/workflows/rubocop.yml @@ -3,7 +3,7 @@ name: RuboCop on: workflow_dispatch: push: - branches: [ "main", "dev/ci" ] + branches: [ "main", "dev/ci", "dev/ci-rubocop" ] pull_request: branches: [ "main" ]