Skip to content

Split out Rubocop into a dedicated job and only run once #2555

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

Merged
merged 1 commit into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ on:
branches:
- '*'
jobs:
rubocop:
name: Rubocop
runs-on: 'ubuntu-20.04'
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
- run: script/update_rubygems_and_install_bundler
- run: bundle install --standalone
- run: bundle binstubs --all
- run: script/run_rubocop

test:
name: 'Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.env.RAILS_VERSION }}'
runs-on: ubuntu-20.04
Expand Down
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ AllCops:
Exclude:
# Templates are really ERB which Rubocop does not parse
- bin/**/*
- bundle/**/*
- lib/generators/rspec/*/templates/**/*
- tmp/**/*

Bundler/DuplicatedGem:
Enabled: false
Expand Down
8 changes: 0 additions & 8 deletions script/predicate_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,3 @@ function documentation_enforced {
return 1
fi
}

function style_and_lint_enforced {
if [ -x ./bin/rubocop ]; then
return 0
else
return 1
fi
}
4 changes: 0 additions & 4 deletions script/run_build
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ if documentation_enforced; then
fold "doc check" check_documentation_coverage
fi

if style_and_lint_enforced; then
fold "rubocop" check_style_and_lint
fi

if is_mri; then
fold "one-by-one specs" run_specs_one_by_one
run_all_spec_suites
Expand Down
14 changes: 14 additions & 0 deletions script/run_rubocop
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# This file was generated on 2022-01-10T22:24:10+00:00 from the rspec-dev repo.
# DO NOT modify it by hand as your changes will get lost the next time it is generated.

set -e
source script/functions.sh

# Allow repos to override the default functions and add their own
if [ -f script/custom_build_functions.sh ]; then
source script/custom_build_functions.sh
fi


fold "rubocop" check_style_and_lint