Skip to content

Commit

Permalink
Add rubocop config
Browse files Browse the repository at this point in the history
previously this gem only contained a rubocop config that's used in our
modules. We didn't run rubocop for the ruby code in this exact gem. This
is changed with this commit.
  • Loading branch information
bastelfreak committed May 24, 2024
1 parent 1cf9586 commit d846e4d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -45,6 +56,7 @@ jobs:
run: bundle exec rake spec
tests:
needs:
- rubocop
- test
runs-on: ubuntu-latest
name: Test suite
Expand Down
3 changes: 3 additions & 0 deletions .rubocop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
inherit_from:
- rubocop.yml
10 changes: 10 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,13 @@ begin
end
rescue LoadError

Check failure on line 17 in Rakefile

View workflow job for this annotation

GitHub Actions / rubocop

Lint/SuppressedException: Do not suppress exceptions. (https://rubystyle.guide#dont-hide-exceptions)
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

0 comments on commit d846e4d

Please sign in to comment.