diff --git a/.github/workflows/rubocop-core.yml b/.github/workflows/rubocop-core.yml index 2f8c1e6ff4a7..4be18e12ccd0 100644 --- a/.github/workflows/rubocop-core.yml +++ b/.github/workflows/rubocop-core.yml @@ -2,11 +2,6 @@ name: rubocop on: pull_request: - branches: - - dev - - release/* - paths: - - '**.rb' jobs: rubocop: @@ -14,12 +9,19 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - fetch-depth: 0 + - name: Fetch all commits for PR branch plus head commit of base branch + run: | + # fetch all commits of the PR branch + git fetch --shallow-exclude "${{ github.base_ref }}" origin "${{ github.ref }}" + # fix for "fatal: error in object: unshallow" + git repack -d + # fetch head commit of base branch + git fetch --deepen 1 origin "${{ github.ref }}" - uses: ruby/setup-ruby@v1 - - uses: opf/action-rubocop@v2 + - uses: opf/action-rubocop@master with: github_token: ${{ secrets.github_token }} rubocop_version: gemfile - rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile + rubocop_extensions: rubocop-inflector:gemfile rubocop-performance:gemfile rubocop-rails:gemfile rubocop-rspec:gemfile reporter: github-pr-check + only_changed: true diff --git a/spec/requests/api/v3/projects/copy/copy_resource_spec.rb b/spec/requests/api/v3/projects/copy/copy_resource_spec.rb index 37ab48d5b104..c5b528a3bb15 100644 --- a/spec/requests/api/v3/projects/copy/copy_resource_spec.rb +++ b/spec/requests/api/v3/projects/copy/copy_resource_spec.rb @@ -71,7 +71,7 @@ subject(:response) { last_response } - # rubocop:disable RSpec/Rails/HaveHttpStatus + # rubocop:disable RSpecRails/HaveHttpStatus # those are mock responses that don't deal well with the rails helpers describe "#POST /api/v3/projects/:id/copy" do describe "with empty params" do @@ -203,5 +203,5 @@ end end end - # rubocop:enable RSpec/Rails/HaveHttpStatus + # rubocop:enable RSpecRails/HaveHttpStatus end diff --git a/spec/requests/api/v3/work_packages/update_resource_spec.rb b/spec/requests/api/v3/work_packages/update_resource_spec.rb index 3d55cb6a288f..084aeefc6d1a 100644 --- a/spec/requests/api/v3/work_packages/update_resource_spec.rb +++ b/spec/requests/api/v3/work_packages/update_resource_spec.rb @@ -269,7 +269,7 @@ include_context "patch request" - it { expect(response.status).to eq(200) } # rubocop:disable RSpec/Rails/HaveHttpStatus + it { expect(response.status).to eq(200) } # rubocop:disable RSpecRails/HaveHttpStatus it "responds with updated finish date" do expect(subject.body).to be_json_eql(duration.to_json).at_path("remainingTime") diff --git a/spec/requests/oauth_clients/callback_flow_spec.rb b/spec/requests/oauth_clients/callback_flow_spec.rb index b184621a20b0..b62d6ce55864 100644 --- a/spec/requests/oauth_clients/callback_flow_spec.rb +++ b/spec/requests/oauth_clients/callback_flow_spec.rb @@ -79,7 +79,7 @@ set_cookie "oauth_state_asdf1234=#{state_cookie}" end - # rubocop:disable RSpec/Rails/HaveHttpStatus + # rubocop:disable RSpecRails/HaveHttpStatus shared_examples "with errors and state param with cookie, not being admin" do it "redirects to URI referenced in the state param and held in a cookie" do expect(response.status).to eq(302) @@ -185,6 +185,6 @@ it_behaves_like "fallback redirect" end - # rubocop:enable RSpec/Rails/HaveHttpStatus + # rubocop:enable RSpecRails/HaveHttpStatus end end