Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Action for RuboCop. #218

Merged
merged 16 commits into from
Jan 3, 2024
31 changes: 31 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: RuboCop

on:
workflow_dispatch:
push:
branches: [ "main", "dev/ci", "dev/ci-rubocop" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
analysis:

runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.7', '3.2']

steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: RuboCop version information
run: bundle exec rubocop -V
- name: Run RuboCop
run: bundle exec rubocop
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
/archive/
/build/
/tests_old/
/vendor/
Debug*/
Release*/
ipch/
Expand Down
28 changes: 10 additions & 18 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,20 @@ require:
- rubocop-sketchup

AllCops:
NewCops: disable
DisabledByDefault: true # TODO: Reenable
DisplayStyleGuide: true
SuggestExtensions: false
SketchUp:
SourcePath: src
TargetSketchUpVersion: 2014
SketchupPerformance:
Exclude:
- ruby-c-extension/**/*
- skippy/**/*
- tests/**/*
- tools/**/*
SketchupRequirements:
Exclude:
- ruby-c-extension/**/*
- skippy/**/*
- tests/**/*
- tools/**/*
SketchupSuggestions:
Exclude:
- ruby-c-extension/**/*
- skippy/**/*
- tests/**/*
- tools/**/*
Exclude:
- Gemfile
- ruby-c-extension/**/*
- skippy/**/*
- tests/**/*
- tools/**/*
- vendor/**/*
TargetRubyVersion: 2.0
Exclude:
- archive/**/*
Expand All @@ -40,6 +30,7 @@ AllCops:
- src/testup/third-party/**/*.rb
- tests/**/*.rb # TODO - for now ignore.
- tools/**/*.rb
- vendor/**/*.rb

SketchupDeprecations:
Enabled: true
Expand Down Expand Up @@ -183,6 +174,7 @@ Style/IfUnlessModifier:

Style/MultilineIfModifier:
Exclude:
- Gemfile
- src/testup/file_reporter.rb
- src/testup/ui.rb
- src/testup/ui/adapters/htmldialog.rb
Expand Down
15 changes: 12 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
source 'https://rubygems.org'

# 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 '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 unless CI_BUILD

group :analytics do
gem 'rubocop', '>= 0.82', '< 2.0'
gem 'rubocop-sketchup', '~> 1.3.0'
gem 'rubocop-performance', '~> 1.15.0'
end