Comments (5)
Firstly I wanted to say I love this project. It's fantastic!
Is it normal that it takes so long if I just add the yml to the workflow?
@paulomcnally, I'm guessing you have quite a large codebase? We managed to work around this issue by only having RuboCop lint files that have changed in the current pull request. The entire workflow is as follows:
name: reviewdog
on: [pull_request]
jobs:
rubocop:
name: runner / rubocop
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Retrive and store changed ruby files
run: echo "INPUT_RUBOCOP_FLAGS=$(git diff --name-only --diff-filter=ACMRTUXB origin/master | grep -E "(\.rb$)" | tr '\n' ' ')" >> $GITHUB_ENV
- uses: ruby/setup-ruby@v1
if: ${{ env.INPUT_RUBOCOP_FLAGS }}
- name: Linting following files
run: echo $INPUT_RUBOCOP_FLAGS
if: ${{ env.INPUT_RUBOCOP_FLAGS }}
- name: rubocop
uses: BiggerPockets/action-rubocop@0b9fdc012b541882a0d8b74cc74ebbbab200bb30
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-rails:gemfile
if: ${{ env.INPUT_RUBOCOP_FLAGS }}
The only complication was needing to fork this repo so we could stop INPUT_RUBOCOP_FLAGS
from being overwritten BiggerPockets@0b9fdc0
I thought I'd share in case it's helpful to anyone else. It got our linting times down from about 8 minutes to around 6 seconds.
Also, if there is a better way to do this, please let me know.
from action-rubocop.
We managed to work around this issue by only having RuboCop lint files that have changed in the current pull request
Seems like this should be the default behaviour, or at least a simple option to enable?
Getting a linting failure because of code not touched in a given PR is not how we would like the action to behave.
from action-rubocop.
If it helps anyone else, this is very similar to the above, but does not require a fork:
name: reviewdog
on: [pull_request]
jobs:
rubocop:
name: runner / rubocop
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.6
- name: Fetch mainline branch for comparison (required for next step)
run: git fetch origin main
- name: Retrieve and store changed ruby files
id: changed-files
run: echo "CHANGED_FILES=$(git diff --name-only --diff-filter=ACMRTUXB FETCH_HEAD | grep -E "(\.rb$)" | tr '\n' ' ')" >> $GITHUB_OUTPUT
- name: Linting the following files
env:
CHANGED_FILES: ${{ steps.changed-files.outputs.CHANGED_FILES }}
run: echo $CHANGED_FILES
- name: rubocop
uses: reviewdog/action-rubocop@v2
with:
rubocop_flags: ${{ steps.changed-files.outputs.CHANGED_FILES }}
rubocop_version: gemfile
rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile rubocop-performance:gemfile
reporter: github-pr-review
from action-rubocop.
Also in case it helps, we ended up creating an alternative rubocop action at https://github.com/reclaim-the-stack/rubocop-action
This one only runs on changed files by default. It also has a very clean inline commenting approach which fully deletes comments after offences are resolved. Ie. it doesn't leave any noise behind in the PR.
from action-rubocop.
Hi! Could you provide a log to check the problem?
from action-rubocop.
Related Issues (20)
- Add ability to skip install of rubocop and extensions HOT 1
- How i can use my own robocop rule? HOT 1
- Set default token to `github_token` input parameter HOT 5
- Undefined method `begin' for PseudoSourceRange HOT 6
- Fail running rubocop step if rubocop command itself fails HOT 5
- gem install was failed with Ruby 2.6.6 HOT 2
- Getting undefined method `cleanpath` when running via GitHub HOT 6
- getting REVIEWDOG_GITHUB_API_TOKEN error HOT 2
- [BUG] Invalid request. Only 65535 characters are allowed; 70292 were supplied. HOT 6
- undefined method `begin' for nil:NilClass HOT 2
- Possible to suggest linting corrections? HOT 5
- GitHub marketplace shows v1 as the latest HOT 2
- Rubocop info severity causes build failure
- reviewdog fails to parse when `--server` option is given HOT 1
- `Style/MethodDefParentheses` creates a suggestion with just one opening parenthese
- Cache ruby gems to speed up installation HOT 2
- Replace actions/create-release HOT 1
- rubocop_extensions installation version from Gemfile does not work with wrong definition order of gems HOT 5
- The suggedtion for `Rails/RedundantActiveRecordAllMethod` is incorrect
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from action-rubocop.