diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ace3130..6d10338 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,6 +10,17 @@ env: BUNDLE_WITHOUT: release jobs: + rubocop: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Ruby ${{ matrix.ruby }} + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.3" + bundler-cache: true + - name: Run Rubocop + run: bundle exec rake rubocop test: runs-on: ubuntu-latest strategy: @@ -45,6 +56,7 @@ jobs: run: bundle exec rake spec tests: needs: + - rubocop - test runs-on: ubuntu-latest name: Test suite diff --git a/.rubocop.yaml b/.rubocop.yaml new file mode 100644 index 0000000..854be61 --- /dev/null +++ b/.rubocop.yaml @@ -0,0 +1,3 @@ +--- +inherit_from: + - rubocop.yml diff --git a/Rakefile b/Rakefile index f3a7386..eac57e5 100644 --- a/Rakefile +++ b/Rakefile @@ -16,3 +16,13 @@ begin end rescue LoadError end + +# this is identical to our config in voxpupuli-rubocop, but that gem targets Ruby 2.7 +# and voxupuli-test depends on an older rubocop version because we provide it for our modules +require 'rubocop/rake_task' +RuboCop::RakeTask.new(:rubocop) do |task| + # These make the rubocop experience maybe slightly less terrible + task.options = ['--display-cop-names', '--display-style-guide', '--extra-details'] + # Use Rubocop's Github Actions formatter if possible + task.formatters << 'github' if ENV['GITHUB_ACTIONS'] == 'true' +end