Skip to content

Commit 6850a26

Browse files
committed
rubocop: use default rake task
1 parent 7c7525f commit 6850a26

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

.github/workflows/checks.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,19 @@ jobs:
1515
name: Rake Checks
1616
runs-on: ubuntu-24.04
1717
steps:
18+
# needs fetch-depth because the packaging dem reads old git tags
1819
- name: Checkout current PR
1920
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
2023
- name: Install Ruby version 3.3
2124
uses: ruby/setup-ruby@v1
2225
with:
2326
ruby-version: 3.3
2427
bundler-cache: true
2528
- name: Validate code
2629
run: |
27-
bundle exec rake rubocop --trace
30+
bundle exec rake rubocop
2831
bundle exec rake -T | grep vox:build
2932
bundle exec rake -T | grep vox:promote
3033
bundle exec rake -T | grep vox:tag

.rubocop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ AllCops:
88
- 'resources/**/*.rb'
99
- 'ext/**/*'
1010
- 'vendor/**/*'
11+
- '.vendor/**/*'
1112
- 'bundle/**/*'
1213

14+
plugins:
15+
- rubocop-rake
16+
1317
Layout/ArgumentAlignment:
1418
Enabled: false
1519

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ gem 'rake'
1717
gem 'json'
1818
gem 'octokit'
1919
gem 'rubocop', "~> 1.22"
20+
gem 'rubocop-rake'
2021

2122
eval_gemfile("#{__FILE__}.local") if File.exist?("#{__FILE__}.local")

Rakefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ load './ext/release-lead.rake'
3939

4040
Pkg::Util::RakeUtils.load_packaging_tasks
4141

42-
desc 'run static analysis with rubocop'
43-
task(:rubocop) do
44-
require 'rubocop'
45-
cli = RuboCop::CLI.new
46-
exit_code = cli.run(%w(--display-cop-names --format simple))
47-
raise "RuboCop detected offenses" if exit_code != 0
42+
require 'rubocop/rake_task'
43+
RuboCop::RakeTask.new(:rubocop) do |task|
44+
# These make the rubocop experience maybe slightly less terrible
45+
task.options = ['--display-cop-names', '--display-style-guide', '--extra-details']
46+
# Use Rubocop's Github Actions formatter if possible
47+
task.formatters << 'github' if ENV['GITHUB_ACTIONS'] == 'true'
4848
end
4949

5050
desc "verify that commit messages match CONTRIBUTING.md requirements"

0 commit comments

Comments
 (0)