reviewdog / action-rubocop Goto Github PK
View Code? Open in Web Editor NEWRun rubocop with reviewdog ๐ถ
License: MIT License
Run rubocop with reviewdog ๐ถ
License: MIT License
GitHub Action should fail if rubocop crashes with an error. For example:
Error: unrecognized cop FactoryBot/DynamicAttributeDefinedStatically found in .rubocop_todo.yml
Add action-yamllint
to lint yaml
files.
Is it normal that it takes so long if I just add the yml to the workflow?
name: Review Dog
on:
pull_request:
branches: [develop]
jobs:
rubocop:
name: dog-pro
runs-on: ubuntu-18.04
steps:
- name: Check out code
uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5.7
- run: gem install activesupport --version 6.1.4.3
- name: rubocop
uses: reviewdog/action-rubocop@v1
with:
github_token: $${{ secrets.github_token }}
rubocop_version: 0.81.0
rubocop_extensions: rubocop-rails:2.5.2
reporter: github-pr-review
fail_on_error: true
tool_name: dog-pro
I canceled it to prevent consuming too much time, I was not sure if it had been in an infinite loop.
It seems like the action does not support push action, Is there a workaround for this?
rubocop version: 0.81.0
action
name: RuboCop
on: [push, pull_request]
jobs:
rubocop:
name: runner / rubocop
runs-on: ubuntu-18.04
steps:
- name: Check out code
uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5.1
- name: rubocop
uses: reviewdog/action-rubocop@v1
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review # Default is github-pr-check
fail_on_error: true
error trace
Running rubocop with reviewdog ๐ถ ...
reviewdog: this is not PullRequest build.
warning: parser/current is loading parser/ruby25, which recognizes
warning: 2.5.8-compliant syntax, but you are running 2.5.1.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file.
Please also note that can also opt-in to new cops by default by adding this to your config:
AllCops:
NewCops: enable
Gemspec/DateAssignment: # (new in 1.10)
Enabled: true
Layout/SpaceBeforeBrackets: # (new in 1.7)
Enabled: true
Lint/AmbiguousAssignment: # (new in 1.7)
Enabled: true
Lint/DeprecatedConstants: # (new in 1.8)
Enabled: true
Lint/DuplicateBranch: # (new in 1.3)
Enabled: true
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
Enabled: true
Lint/EmptyBlock: # (new in 1.1)
Enabled: true
Lint/EmptyClass: # (new in 1.3)
Enabled: true
Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
Enabled: true
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
Enabled: true
Lint/NumberedParameterAssignment: # (new in 1.9)
Enabled: true
Lint/OrAssignmentToConstant: # (new in 1.9)
Enabled: true
Lint/RedundantDirGlobSort: # (new in 1.8)
Enabled: true
Lint/SymbolConversion: # (new in 1.9)
Enabled: true
Lint/ToEnumArguments: # (new in 1.1)
Enabled: true
Lint/TripleQuotes: # (new in 1.9)
Enabled: true
Lint/UnexpectedBlockArity: # (new in 1.5)
Enabled: true
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
Enabled: true
Style/ArgumentsForwarding: # (new in 1.1)
Enabled: true
Style/CollectionCompact: # (new in 1.2)
Enabled: true
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
Enabled: true
Style/EndlessMethod: # (new in 1.8)
Enabled: true
Style/HashConversion: # (new in 1.10)
Enabled: true
Style/HashExcept: # (new in 1.7)
Enabled: true
Style/IfWithBooleanLiteralBranches: # (new in 1.9)
Enabled: true
Style/NegatedIfElseCondition: # (new in 1.2)
Enabled: true
Style/NilLambda: # (new in 1.3)
Enabled: true
Style/RedundantArgument: # (new in 1.4)
Enabled: true
Style/SwapValues: # (new in 1.1)
Enabled: true
For more information: https://docs.rubocop.org/rubocop/versioning.html
The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file.
Please also note that can also opt-in to new cops by default by adding this to your config:
AllCops:
NewCops: enable
Gemspec/DateAssignment: # (new in 1.10)
Enabled: true
Layout/SpaceBeforeBrackets: # (new in 1.7)
Enabled: true
Lint/AmbiguousAssignment: # (new in 1.7)
Enabled: true
Lint/DeprecatedConstants: # (new in 1.8)
Enabled: true
Lint/DuplicateBranch: # (new in 1.3)
Enabled: true
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
Enabled: true
Lint/EmptyBlock: # (new in 1.1)
Enabled: true
Lint/EmptyClass: # (new in 1.3)
Enabled: true
Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
Enabled: true
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
Enabled: true
Lint/NumberedParameterAssignment: # (new in 1.9)
Enabled: true
Lint/OrAssignmentToConstant: # (new in 1.9)
Enabled: true
Lint/RedundantDirGlobSort: # (new in 1.8)
Enabled: true
Lint/SymbolConversion: # (new in 1.9)
Enabled: true
Lint/ToEnumArguments: # (new in 1.1)
Enabled: true
Lint/TripleQuotes: # (new in 1.9)
Enabled: true
Lint/UnexpectedBlockArity: # (new in 1.5)
Enabled: true
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
Enabled: true
Style/ArgumentsForwarding: # (new in 1.1)
Enabled: true
Style/CollectionCompact: # (new in 1.2)
Enabled: true
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
Enabled: true
Style/EndlessMethod: # (new in 1.8)
Enabled: true
Style/HashConversion: # (new in 1.10)
Enabled: true
Style/HashExcept: # (new in 1.7)
Enabled: true
Style/IfWithBooleanLiteralBranches: # (new in 1.9)
Enabled: true
Style/NegatedIfElseCondition: # (new in 1.2)
Enabled: true
Style/NilLambda: # (new in 1.3)
Enabled: true
Style/RedundantArgument: # (new in 1.4)
Enabled: true
Style/SwapValues: # (new in 1.1)
Enabled: true
For more information: https://docs.rubocop.org/rubocop/versioning.html
The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file.
Please also note that can also opt-in to new cops by default by adding this to your config:
AllCops:
NewCops: enable
Gemspec/DateAssignment: # (new in 1.10)
Enabled: true
Layout/SpaceBeforeBrackets: # (new in 1.7)
Enabled: true
Lint/AmbiguousAssignment: # (new in 1.7)
Enabled: true
Lint/DeprecatedConstants: # (new in 1.8)
Enabled: true
Lint/DuplicateBranch: # (new in 1.3)
Enabled: true
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
Enabled: true
Lint/EmptyBlock: # (new in 1.1)
Enabled: true
Lint/EmptyClass: # (new in 1.3)
Enabled: true
Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
Enabled: true
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
Enabled: true
Lint/NumberedParameterAssignment: # (new in 1.9)
Enabled: true
Lint/OrAssignmentToConstant: # (new in 1.9)
Enabled: true
Lint/RedundantDirGlobSort: # (new in 1.8)
Enabled: true
Lint/SymbolConversion: # (new in 1.9)
Enabled: true
Lint/ToEnumArguments: # (new in 1.1)
Enabled: true
Lint/TripleQuotes: # (new in 1.9)
Enabled: true
Lint/UnexpectedBlockArity: # (new in 1.5)
Enabled: true
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
Enabled: true
Style/ArgumentsForwarding: # (new in 1.1)
Enabled: true
Style/CollectionCompact: # (new in 1.2)
Enabled: true
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
Enabled: true
Style/EndlessMethod: # (new in 1.8)
Enabled: true
Style/HashConversion: # (new in 1.10)
Enabled: true
Style/HashExcept: # (new in 1.7)
Enabled: true
Style/IfWithBooleanLiteralBranches: # (new in 1.9)
Enabled: true
Style/NegatedIfElseCondition: # (new in 1.2)
Enabled: true
Style/NilLambda: # (new in 1.3)
Enabled: true
Style/RedundantArgument: # (new in 1.4)
Enabled: true
Style/SwapValues: # (new in 1.1)
Enabled: true
For more information: https://docs.rubocop.org/rubocop/versioning.html
The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file.
Please also note that can also opt-in to new cops by default by adding this to your config:
AllCops:
NewCops: enable
Gemspec/DateAssignment: # (new in 1.10)
Enabled: true
Layout/SpaceBeforeBrackets: # (new in 1.7)
Enabled: true
Lint/AmbiguousAssignment: # (new in 1.7)
Enabled: true
Lint/DeprecatedConstants: # (new in 1.8)
Enabled: true
Lint/DuplicateBranch: # (new in 1.3)
Enabled: true
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
Enabled: true
Lint/EmptyBlock: # (new in 1.1)
Enabled: true
Lint/EmptyClass: # (new in 1.3)
Enabled: true
Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
Enabled: true
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
Enabled: true
Lint/NumberedParameterAssignment: # (new in 1.9)
Enabled: true
Lint/OrAssignmentToConstant: # (new in 1.9)
Enabled: true
Lint/RedundantDirGlobSort: # (new in 1.8)
Enabled: true
Lint/SymbolConversion: # (new in 1.9)
Enabled: true
Lint/ToEnumArguments: # (new in 1.1)
Enabled: true
Lint/TripleQuotes: # (new in 1.9)
Enabled: true
Lint/UnexpectedBlockArity: # (new in 1.5)
Enabled: true
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
Enabled: true
Style/ArgumentsForwarding: # (new in 1.1)
Enabled: true
Style/CollectionCompact: # (new in 1.2)
Enabled: true
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
Enabled: true
Style/EndlessMethod: # (new in 1.8)
Enabled: true
Style/HashConversion: # (new in 1.10)
Enabled: true
Style/HashExcept: # (new in 1.7)
Enabled: true
Style/IfWithBooleanLiteralBranches: # (new in 1.9)
Enabled: true
Style/NegatedIfElseCondition: # (new in 1.2)
Enabled: true
Style/NilLambda: # (new in 1.3)
Enabled: true
Style/RedundantArgument: # (new in 1.4)
Enabled: true
Style/SwapValues: # (new in 1.1)
Enabled: true
For more information: https://docs.rubocop.org/rubocop/versioning.html
The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file.
Please also note that can also opt-in to new cops by default by adding this to your config:
AllCops:
NewCops: enable
Gemspec/DateAssignment: # (new in 1.10)
Enabled: true
Layout/SpaceBeforeBrackets: # (new in 1.7)
Enabled: true
Lint/AmbiguousAssignment: # (new in 1.7)
Enabled: true
Lint/DeprecatedConstants: # (new in 1.8)
Enabled: true
Lint/DuplicateBranch: # (new in 1.3)
Enabled: true
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
Enabled: true
Lint/EmptyBlock: # (new in 1.1)
Enabled: true
Lint/EmptyClass: # (new in 1.3)
Enabled: true
Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
Enabled: true
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
Enabled: true
Lint/NumberedParameterAssignment: # (new in 1.9)
Enabled: true
Lint/OrAssignmentToConstant: # (new in 1.9)
Enabled: true
Lint/RedundantDirGlobSort: # (new in 1.8)
Enabled: true
Lint/SymbolConversion: # (new in 1.9)
Enabled: true
Lint/ToEnumArguments: # (new in 1.1)
Enabled: true
Lint/TripleQuotes: # (new in 1.9)
Enabled: true
Lint/UnexpectedBlockArity: # (new in 1.5)
Enabled: true
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
Enabled: true
Style/ArgumentsForwarding: # (new in 1.1)
Enabled: true
Style/CollectionCompact: # (new in 1.2)
Enabled: true
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
Enabled: true
Style/EndlessMethod: # (new in 1.8)
Enabled: true
Style/HashConversion: # (new in 1.10)
Enabled: true
Style/HashExcept: # (new in 1.7)
Enabled: true
Style/IfWithBooleanLiteralBranches: # (new in 1.9)
Enabled: true
Style/NegatedIfElseCondition: # (new in 1.2)
Enabled: true
Style/NilLambda: # (new in 1.3)
Enabled: true
Style/RedundantArgument: # (new in 1.4)
Enabled: true
Style/SwapValues: # (new in 1.1)
Enabled: true
For more information: https://docs.rubocop.org/rubocop/versioning.html
The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file.
Please also note that can also opt-in to new cops by default by adding this to your config:
AllCops:
NewCops: enable
Gemspec/DateAssignment: # (new in 1.10)
Enabled: true
Layout/SpaceBeforeBrackets: # (new in 1.7)
Enabled: true
Lint/AmbiguousAssignment: # (new in 1.7)
Enabled: true
Lint/DeprecatedConstants: # (new in 1.8)
Enabled: true
Lint/DuplicateBranch: # (new in 1.3)
Enabled: true
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
Enabled: true
Lint/EmptyBlock: # (new in 1.1)
Enabled: true
Lint/EmptyClass: # (new in 1.3)
Enabled: true
Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
Enabled: true
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
Enabled: true
Lint/NumberedParameterAssignment: # (new in 1.9)
Enabled: true
Lint/OrAssignmentToConstant: # (new in 1.9)
Enabled: true
Lint/RedundantDirGlobSort: # (new in 1.8)
Enabled: true
Lint/SymbolConversion: # (new in 1.9)
Enabled: true
Lint/ToEnumArguments: # (new in 1.1)
Enabled: true
Lint/TripleQuotes: # (new in 1.9)
Enabled: true
Lint/UnexpectedBlockArity: # (new in 1.5)
Enabled: true
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
Enabled: true
Style/ArgumentsForwarding: # (new in 1.1)
Enabled: true
Style/CollectionCompact: # (new in 1.2)
Enabled: true
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
Enabled: true
Style/EndlessMethod: # (new in 1.8)
Enabled: true
Style/HashConversion: # (new in 1.10)
Enabled: true
Style/HashExcept: # (new in 1.7)
Enabled: true
Style/IfWithBooleanLiteralBranches: # (new in 1.9)
Enabled: true
Style/NegatedIfElseCondition: # (new in 1.2)
Enabled: true
Style/NilLambda: # (new in 1.3)
Enabled: true
Style/RedundantArgument: # (new in 1.4)
Enabled: true
Style/SwapValues: # (new in 1.1)
Enabled: true
For more information: https://docs.rubocop.org/rubocop/versioning.html
Broken pipe @ io_write - <STDOUT>
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/formatter/clang_style_formatter.rb:18:in `write'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/formatter/clang_style_formatter.rb:18:in `printf'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/formatter/clang_style_formatter.rb:18:in `report_offense'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/formatter/clang_style_formatter.rb:12:in `block in report_file'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/formatter/clang_style_formatter.rb:12:in `each'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/formatter/clang_style_formatter.rb:12:in `report_file'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/formatter/progress_formatter.rb:42:in `block in finished'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/formatter/progress_formatter.rb:41:in `each'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/formatter/progress_formatter.rb:41:in `finished'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/formatter/formatter_set.rb:34:in `public_send'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/formatter/formatter_set.rb:34:in `block (3 levels) in <class:FormatterSet>'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/formatter/formatter_set.rb:34:in `each'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/formatter/formatter_set.rb:34:in `block (2 levels) in <class:FormatterSet>'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/runner.rb:95:in `ensure in inspect_files'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/runner.rb:96:in `inspect_files'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/runner.rb:47:in `run'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/cli/command/execute_runner.rb:17:in `run'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/cli/command.rb:11:in `run'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/cli/environment.rb:18:in `run'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/cli.rb:65:in `run_command'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/cli.rb:72:in `execute_runners'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/lib/rubocop/cli.rb:41:in `run'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/exe/rubocop:13:in `block in <top (required)>'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/opt/hostedtoolcache/Ruby/2.5.1/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.11.0/exe/rubocop:12:in `<top (required)>'
/opt/hostedtoolcache/Ruby/2.5.1/x64/bin/rubocop:23:in `load'
First, thanks a lot for creating this, so useful ๐
In my review comments, I am seeing my profile and not the GitHub action profile? Is there a way to fix this?
secrets.GIT_HUB_TOKEN
this is the token that I created based on these instructions - https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
Could this be a token issue?
Config that I am using...
jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
- name: Rubocop
uses: reviewdog/action-rubocop@v1
with:
github_token: ${{secrets.GIT_HUB_TOKEN}}
reporter: github-pr-review # Default is github-pr-check
Derived from #73 (comment)
The marketplace page still shows v1 as the latest action-rubocop version in spite of v2 being the latest. Unfortunately, some users start using this GitHub Action's v1 due to that.
Why don't you update the description on the marketplace?
So does anyone have permission to edit the marketplace page? I apparently don't have it.
Hi,
I am trying to use this action but every time I run it it's giving me this error, the rubocop itself doesn't have any errors.
reviewdog: environment variable $REVIEWDOG_GITHUB_API_TOKEN is not set
This fails the action.
I have also tried to manually set the github_token
param (as it's optional), but still the same.
Here is my workflow file
name: "๐ Lint"
on: workflow_call
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup ruby and install dependencies
uses: ruby/[email protected]
with:
bundler-cache: true
- name: Setup rubocop with reviewdog
uses: reviewdog/action-rubocop@v1
with:
github_token: ${{ github.token }}
rubocop_version: gemfile
rubocop_extensions: rubocop-rails:gemfile rubocop-minitest:gemfile rubocop-performance:gemfile rubocop-thread_safety:gemfile
When I run reviewdog/action-rubocop
with rubocop_flags: --server
option, reviewdog
command fails to parse its result.
Running rubocop with reviewdog ๐ถ ...
reviewdog: parse error: failed to unmarshal rdjson (DiagnosticResult): proto: syntax error (line 1:1): invalid value RuboCop
Error: Process completed with exit code 1.
rubocop with --server
option always outputs server info, and it's not parsable for reviewdog
.
$ rubocop ./test/rdjson_formatter/testdata/*.rb --require ./rdjson_formatter/rdjson_formatter.rb --format RdjsonFormatter --server
RuboCop server starting on 127.0.0.1:58694. # <= This line is not parsable.
{"source":{"name":"rubocop","url":"https://rubocop.org/"},"diagnostics":[{"message":"Missing frozen string literal comment.","location":{"path":"test/rdjson_formatter/testdata/correctable_offenses.rb","range":{"start":{"line":1,"column":1},"end":{"line":1,"column":2}}},"severity":"UNKNOWN_SEVERITY","code":{"value":"Style/FrozenStringLiteralComment"},"original_output":"C: 1: 1: Style/FrozenStringLiteralComment: Missing frozen string literal comment."},{"message":"Space missing after comma.","location":{"path":"test/rdjson_formatter/testdata/correctable_offenses.rb","range":{"start":{"line":1,"column":12},"end":{"line":1,"column":13}}},"severity":"UNKNOWN_SEVERITY","code":{"value":"Layout/SpaceAfterComma"},"original_output":"C: 1: 12: Layout/SpaceAfterComma: Space missing after comma."},{"message":"Unnecessary spacing detected.","location":{"path":"test/rdjson_formatter/testdata/correctable_offenses.rb","range":{"start":{"line":2,"column":4},"end":{"line":2,"column":7}}},"severity":"UNKNOWN_SEVERITY","code":{"value":"Layout/ExtraSpacing"},"original_output":"C: 2: 4: Layout/ExtraSpacing: Unnecessary spacing detected."},{"message":"Surrounding space missing for operator `+`.","location":{"path":"test/rdjson_formatter/testdata/correctable_offenses.rb","range":{"start":{"line":2,"column":13},"end":{"line":2,"column":14}}},"severity":"UNKNOWN_SEVERITY","code":{"value":"Layout/SpaceAroundOperators"},"original_output":"C: 2: 13: Layout/SpaceAroundOperators: Surrounding space missing for operator `+`."},{"message":"Unnecessary spacing detected.","location":{"path":"test/rdjson_formatter/testdata/correctable_offenses.rb","range":{"start":{"line":2,"column":14},"end":{"line":2,"column":16}}},"severity":"UNKNOWN_SEVERITY","code":{"value":"Layout/ExtraSpacing"},"original_output":"C: 2: 14: Layout/ExtraSpacing: Unnecessary spacing detected."},{"message":"Do not use semicolons to terminate expressions.","location":{"path":"test/rdjson_formatter/testdata/correctable_offenses.rb","range":{"start":{"line":2,"column":20},"end":{"line":2,"column":21}}},"severity":"UNKNOWN_SEVERITY","code":{"value":"Style/Semicolon"},"original_output":"C: 2: 20: Style/Semicolon: Do not use semicolons to terminate expressions."},{"message":"Redundant `return` detected.","location":{"path":"test/rdjson_formatter/testdata/correctable_offenses.rb","range":{"start":{"line":3,"column":3},"end":{"line":3,"column":9}}},"severity":"UNKNOWN_SEVERITY","code":{"value":"Style/RedundantReturn"},"original_output":"C: 3: 3: Style/RedundantReturn: Redundant `return` detected."},{"message":"Unnecessary spacing detected.","location":{"path":"test/rdjson_formatter/testdata/correctable_offenses.rb","range":{"start":{"line":3,"column":9},"end":{"line":3,"column":10}}},"severity":"UNKNOWN_SEVERITY","code":{"value":"Layout/ExtraSpacing"},"original_output":"C: 3: 9: Layout/ExtraSpacing: Unnecessary spacing detected."},{"message":"Empty file detected.","location":{"path":"test/rdjson_formatter/testdata/global_offenses.rb","range":{"start":{"line":1,"column":1},"end":{"line":1,"column":1}}},"severity":"UNKNOWN_SEVERITY","code":{"value":"Lint/EmptyFile"},"original_output":"W: 1: 1: Lint/EmptyFile: Empty file detected."},{"message":"Method parameter must be at least 3 characters long.","location":{"path":"test/rdjson_formatter/testdata/not_correctable_offenses.rb","range":{"start":{"line":4,"column":15},"end":{"line":4,"column":16}}},"severity":"UNKNOWN_SEVERITY","code":{"value":"Naming/MethodParameterName"},"original_output":"C: 4: 15: Naming/MethodParameterName: Method parameter must be at least 3 characters long."},{"message":"Method parameter must be at least 3 characters long.","location":{"path":"test/rdjson_formatter/testdata/not_correctable_offenses.rb","range":{"start":{"line":4,"column":18},"end":{"line":4,"column":19}}},"severity":"UNKNOWN_SEVERITY","code":{"value":"Naming/MethodParameterName"},"original_output":"C: 4: 18: Naming/MethodParameterName: Method parameter must be at least 3 characters long."},{"message":"Useless assignment to variable - `c`.","location":{"path":"test/rdjson_formatter/testdata/not_correctable_offenses.rb","range":{"start":{"line":5,"column":5},"end":{"line":5,"column":6}}},"severity":"UNKNOWN_SEVERITY","code":{"value":"Lint/UselessAssignment"},"original_output":"W: 5: 5: Lint/UselessAssignment: Useless assignment to variable - `c`."}]}
I suspect that GitHub changed something on their end - now action-rubocop
always fails for me because it can't install the rubocop gem:
Run reviewdog/action-rubocop@v1
with:
rubocop_flags: --fail-level=warning
rubocop_version: 1.8.1
rubocop_extensions: rubocop-performance:1.9.2
github_token: ***
reporter: github-pr-review
fail_on_error: true
tool_name: rubocop
level: error
filter_mode: added
workdir: .
๐ถ Installing reviewdog ... https://github.com/reviewdog/reviewdog
reviewdog/reviewdog info checking GitHub for tag 'v0.11.0'
reviewdog/reviewdog info found version: 0.11.0 for v0.11.0/Linux/x86_64
reviewdog/reviewdog info installed /tmp/tmp.rMlSghgehc/reviewdog
Installing rubocop with extensions ... https://github.com/rubocop/rubocop
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /var/lib/gems/2.7.0 directory.
Error: Process completed with exit code 1.
I am invoking it like this:
rubocop:
name: rubocop
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: false
- name: rubocop
if: always()
uses: reviewdog/action-rubocop@v1
with:
rubocop_flags: --fail-level=warning
rubocop_version: "1.8.1"
rubocop_extensions: rubocop-performance:1.9.2
github_token: ${{ secrets.BOT_GH_TOKEN }}
reporter: github-pr-review
fail_on_error: true
actions/create-release
used above is unmaintained and uses the deprecated Node.js 12.
Therefore, it should be replaced with other Actions.
[FYI]
We've been using this action for sometime with a custom rubocop extension (which passes in a config loaded from a gemfile). The workflow looks like:
- name: rubocop
uses: reviewdog/action-rubocop@v1
with:
rubocop_version: 0.88
rubocop_extensions: rubocop-performance:1.5.1 rubocop-minitest rewind-ruby-style
github_token: ${{ secrets.github_token }}
filter_mode: file
The extension is rewind-ruby-style
.
This was working fine but it looks like the commit on Sept 3 (e6c1833#diff-b958f585a04af5ee2087610ea7180f34) assumes all extensions will begin with the string rubocop
. Which isn't correct when using an extension as a custom rubocop "load from gem" config.
Could this be changed back to allow extensions that don't have the string rubocop in them?
Any action run I try fails with Invalid request. Only 65535 characters are allowed; 70292 were supplied.
Configuration:
name: Rubocop
on: pull_request
jobs:
rubocop:
name: runner / rubocop
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.0
- name: rubocop
uses: reviewdog/action-rubocop@v2
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile
reporter: github-pr-check # Default is github-pr-check
Hi, I see it's possible to have reviewdog leave a comment for linting errors. However, it'd be useful if it suggested the corresponding linting correction as well, so that users could apply the suggestion in one click. Is it possible to set up reviewdog to offer suggested corrections as well?
It takes about a minute to install the gems with extensions on my CI runs.
Would it be possible to cache the gem installation?
Another thought - I use the ruby/setup-ruby@v1
to set up ruby before running review dog. Would it be possible to use the same cache as that GH action?
I have rubocop version 0.89 and am using the latest action-rubocop@v2
Hi there,
In this issue, I suggest making the github_token
input parameter optional by setting the default token (secrets.GITHUB_TOKEN
or github.token
).
The reason is that people can use this action with less configuration code.
Lines 5 to 7 in bc5455e
For example, the change would be like this:
github_token:
description: 'GITHUB_TOKEN'
- required: true
+ default: ${{ github.token }}
See also:
I'm not sure if this is the right repo to post this issue, but we've been getting the following error: undefined method 'cleanpath' for "/home/runner/work/NAME/NAME":String
(where NAME
is the name of our project).
Rails: 5.2.4.4
Ruby: 2.5.3
RuboCop: 1.22.2
config file:
name: Run rubocop with reviewdog
on: [pull_request]
jobs:
rubocop:
name: runner / rubocop
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5.3
- name: rubocop
env:
GITHUB_TOKEN: ${{ secrets.REVIEWDOG_RUNNER }}
uses: reviewdog/action-rubocop@v2
with:
rubocop_version: gemfile
rubocop_extensions: false
reporter: github-pr-review
undefined method 'cleanpath' for "/home/runner/work/NAME/NAME":String
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/2.5.0/pathname.rb:508:in `relative_path_from'
/home/runner/work/_actions/reviewdog/action-rubocop/v2/rdjson_formatter/rdjson_formatter.rb:117:in `convert_path'
/home/runner/work/_actions/reviewdog/action-rubocop/v2/rdjson_formatter/rdjson_formatter.rb:40:in `build_diagnostic'
/home/runner/work/_actions/reviewdog/action-rubocop/v2/rdjson_formatter/rdjson_formatter.rb:21:in `block in file_finished'
/home/runner/work/_actions/reviewdog/action-rubocop/v2/rdjson_formatter/rdjson_formatter.rb:18:in `each'
/home/runner/work/_actions/reviewdog/action-rubocop/v2/rdjson_formatter/rdjson_formatter.rb:18:in `file_finished'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/formatter/formatter_set.rb:50:in `block in file_finished'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/formatter/formatter_set.rb:50:in `each'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/formatter/formatter_set.rb:50:in `file_finished'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/runner.rb:213:in `file_finished'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/runner.rb:125:in `process_file'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/runner.rb:101:in `block in each_inspected_file'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/runner.rb:100:in `each'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/runner.rb:100:in `reduce'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/runner.rb:100:in `each_inspected_file'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/runner.rb:86:in `inspect_files'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/runner.rb:47:in `run'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/cli/command/execute_runner.rb:26:in `block in execute_runner'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/cli/command/execute_runner.rb:52:in `with_redirect'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/cli/command/execute_runner.rb:17:in `run'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/cli/command.rb:11:in `run'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/cli/environment.rb:18:in `run'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/cli.rb:71:in `run_command'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/cli.rb:78:in `execute_runners'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/lib/rubocop/cli.rb:47:in `run'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/exe/rubocop:12:in `block in '
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/opt/hostedtoolcache/Ruby/2.5.3/x64/lib/ruby/gems/2.5.0/gems/rubocop-1.22.2/exe/rubocop:12:in `'
/opt/hostedtoolcache/Ruby/2.5.3/x64/bin/rubocop:23:in `load'
/opt/hostedtoolcache/Ruby/2.5.3/x64/bin/rubocop:23:in `'
I'm maintaining ros-apartment and i'm trying to get review dog to run rubocop on it.
Seems like it's always picking up the latest version of rubocop even if i specify the version in the action configuration
Am i missing something?
If a previous step in our action like setup-ruby
already installs rubocop and the required extensions based on Gemfile
there should be no need to do it again here. It would be nice to be able to skip the rubocop install and just run it.
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
How do I set up to use my own robocop rules?
Does this action already use the rule configured in the project?
Add action-shellcheck
to lint shell scripts.
Add action-misspell
to correct commonly misspelled English words in source files.
gemfile
version does not work because of "pcregrep: not found"
/home/runner/work/_actions/reviewdog/action-rubocop/master/script.sh: 24: /home/runner/work/_actions/reviewdog/action-rubocop/master/script.sh: pcregrep: not found
Cannot get the rubocop's version from Gemfile.lock. The latest version will be installed.
Tested on v1 and master. Seems the problem started from v1.8, after migrating from Dockerfile.
GH-workflow config:
name: Lint
on:
pull_request:
jobs:
ruby:
name: Ruby
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
- name: Run Rubocop
uses: reviewdog/action-rubocop@master
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-rails:gemfile
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
Action: https://github.com/Slike9/rails-test-prj/runs/1938560595?check_suite_focus=true
Possible solutions:
pcregrep
to use gemfile
version in your GH-workflow.pcregrep
for us. There are problems with portability. We can use some portable way of installing the tool. Or we can stick with ubuntu for example.pcregrep
, something more ubiquitous. Suspect we can use sed, grep, a Ruby-script, smth else there.Since rubocop-rspec
requires rubocop-factory_bot
and rubocop-capybara
, rubocop-factory_bot
and rubocop-capybara
installation version from Gemfile does not work if you set rubocop-factory_bot:gemfile
or rubocop-capybara:gemfile
after rubocop-rspec
in option rubocop_extensions
.
# Gemfile.lock
rubocop-rspec (2.24.0)
rubocop (~> 1.33)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
...
rubocop-capybara (2.18.0)
...
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
# ci setting
- name: rubocop
uses: reviewdog/action-rubocop@v2
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile rubocop-performance:gemfile rubocop-checkstyle_formatter:gemfile rubocop-select:gemfile rubocop-factory_bot:gemfile rubocop-capybara:gemfile
# logs
Installing rubocop with extensions ... https://github.com/rubocop/rubocop
Successfully installed unicode-display_width-2.4.2
Successfully installed ruby-progressbar-1.13.0
Successfully installed ast-2.4.2
Successfully installed parser-3.2.2.3
Successfully installed rubocop-ast-1.29.0
Successfully installed regexp_parser-2.8.1
Successfully installed rainbow-3.1.1
Successfully installed parallel-1.23.0
Successfully installed language_server-protocol-3.17.0.3
Successfully installed rubocop-1.56.3
10 gems installed
Successfully installed rack-3.0.8
Successfully installed concurrent-ruby-1.2.2
Successfully installed tzinfo-2.0.6
Successfully installed i18n-1.14.1
Successfully installed activesupport-7.0.8
Successfully installed rubocop-rails-2.21.1
6 gems installed
Successfully installed rubocop-factory_bot-2.24.0 # triggered by rubocop-rspec:gemfile
Successfully installed rubocop-capybara-2.19.0 # triggered by rubocop-rspec:gemfile but rubocop-capybara installed with latest version due to rubocop-rspec requires rubocop-capybara(~> 2.17)
Successfully installed rubocop-rspec-2.24.0
3 gems installed
Successfully installed rubocop-performance-1.19.1
1 gem installed
Successfully installed rubocop-checkstyle_formatter-0.6.0
1 gem installed
Successfully installed rubocop-select-2.0.0
1 gem installed
Successfully installed rubocop-factory_bot-2.24.0 # triggered by rubocop-factory_bot:gemfile
1 gem installed
Successfully installed rubocop-capybara-2.18.0 # triggered by rubocop-capybara:gemfile
1 gem installed
This might cause unexpected rubocop violations due to new rules in latest gem version.
To avoid this at this point, we need to take the definition order of gems into account. But I think it would be better not to depend on definition order since we can not notice easily why ci fails suddenly.
# ci setting
- name: rubocop
uses: reviewdog/action-rubocop@v2
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-factory_bot:gemfile rubocop-capybara:gemfile rubocop-rails:gemfile rubocop-rspec:gemfile rubocop-performance:gemfile rubocop-checkstyle_formatter:gemfile rubocop-select:gemfile
# logs
Successfully installed unicode-display_width-2.4.2
Successfully installed ruby-progressbar-1.13.0
Successfully installed ast-2.4.2
Successfully installed parser-3.2.2.3
Successfully installed rubocop-ast-1.29.0
Successfully installed regexp_parser-2.8.1
Successfully installed rainbow-3.1.1
Successfully installed parallel-1.23.0
Successfully installed language_server-protocol-3.17.0.3
Successfully installed rubocop-1.56.3
10 gems installed
Successfully installed rubocop-factory_bot-2.24.0 # expected version
1 gem installed
Successfully installed rubocop-capybara-2.18.0 # expected version
1 gem installed
Successfully installed rack-3.0.8
Successfully installed concurrent-ruby-1.2.2
Successfully installed tzinfo-2.0.6
Successfully installed i18n-1.14.1
Successfully installed activesupport-7.0.8
Successfully installed rubocop-rails-2.21.1
6 gems installed
Successfully installed rubocop-rspec-2.24.0 # no more installation rubocop-factory_bot and rubocop-capybara because already exists
1 gem installed
Successfully installed rubocop-performance-1.19.1
1 gem installed
Successfully installed rubocop-checkstyle_formatter-0.6.0
1 gem installed
Successfully installed rubocop-select-2.0.0
1 gem installed
Hi, thank you for such useful library.
I want to specify rails version of rubocop-rails by passing to RAILS_VERSION
environment variable to rubocop-rails.
I got below errors during action-rubocop. As you see, the errors were caused by dependencies resolving errors. I think rubocop-rails tries to install the latest version of rails, even if developers provide desired version of rubocop-rails like this rubocop_extensions: rubocop-rails:gemfile
. However the rails(activesupport) 6.1.4.4 does not support ruby 2.6.6, so the errors occurred.
Run reviewdog/action-rubocop@v1
Run $GITHUB_ACTION_PATH/script.sh
๐ถ Installing reviewdog ... https://github.com/reviewdog/reviewdog
Installing rubocop with extensions ... https://github.com/rubocop/rubocop
Successfully installed parallel-1.21.0
Successfully installed ast-2.4.2
Successfully installed parser-3.0.3.2
Successfully installed rainbow-3.0.0
Successfully installed regexp_parser-2.2.0
Successfully installed rubocop-ast-1.15.0
Successfully installed ruby-progressbar-1.11.0
Successfully installed unicode-display_width-2.1.0
Successfully installed rubocop-1.23.0
9 gems installed
ERROR: Error installing rubocop-rails:
The last version of activesupport (>= 4.2.0) to support your Ruby & RubyGems was 6.1.4.4. Try installing it with `gem install activesupport -v 6.1.4.4` and then running the current command again
Successfully installed concurrent-ruby-1.1.9
Successfully installed i18n-1.8.11
Successfully installed tzinfo-2.0.4
activesupport requires Ruby version >= 2.7.0. The current ruby version is 2.6.6.146.
Error: Process completed with exit code 1.
Although we can provide desired rails version to rubocop-rails with some options (ex: RAILS_VERSION environment variable ), I couldn't pass RAILS_VERION by writing it in CI yaml file for reviewdog.
like this
name: reviewdog
on: [pull_request]
jobs:
rubocop:
env:
RAILS_VERSION: 6.1.4.1 # desired Rails version for rubocop-rails
name: runner / rubocop
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.6
- name: rubocop
uses: reviewdog/action-rubocop@v1
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile rubocop-performance:gemfile rubocop-i18n:gemfile rubocop-rake:gemfile
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
filter_mode: added
Do you have any ideas to resolve the issue?
I have an info
level Rubocop issue. It is reported as such in the reviewdog github action:
Expected behaviour: Reviewdog should report the issue but pass the build.
Actual behaviour: Build is failing.
I can see that reviewdog concludes this is a failure:
2022/05/27 01:54:05 [rubocop] reported: https://github.com/bettercaring/better_caring/runs/6619239483 (conclusion=failure)
I have set rubocop fail level flag on my github workflow reviewdog action configuration:
- name: rubocop
uses: reviewdog/action-rubocop@v1
with:
github_token: ${{ secrets.github_token }}
rubocop_version: gemfile
rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile
filter_mode: added
rubocop_flags: '--fail-level E'
I also tried uses: reviewdog/action-rubocop@v2
but that resulted in two reports, both at error level:
I have upgraded to rubocop version 1.30.0.
I have written a script to report the rubocop version and exit code, which results in:
$ tmp/rubo.sh
1.30.0
.rubocop.yml:23: `IgnoredMethods` is concealed by line 25
Inspecting 1 file
I
Offenses:
app/controllers/lobbies_controller.rb:64:5: I: Naming/MemoizedInstanceVariableName: Memoized variable @lobby does not match method name find_or_create_lobby_by_conversation. Use @find_or_create_lobby_by_conversation instead.
@lobby ||= Lobbies::FindOrCreateService.new(conversation: conv, user: current_target).process
^^^^^^
1 file inspected, 1 offense detected
Tip: Based on detected gems, the following RuboCop extension libraries might be helpful:
* rubocop-graphql (https://rubygems.org/gems/rubocop-graphql)
* rubocop-rake (https://rubygems.org/gems/rubocop-rake)
You can opt out of this message by adding the following to your config (see https://docs.rubocop.org/rubocop/extensions.html#extension-suggestions for more options):
AllCops:
SuggestExtensions: false
0
You can see here that the Rubocop exit code is 0, as hoped.
We should add tests to avoid this (#31) kind of failure before merging it similar to https://github.com/reviewdog/action-template and other actions.
@mgrachev Can you work on it?
If rubocop
command itself fails, e.g. because of incorrect rubocop config, the step is considered successful. The error or rubocop command is ignored because of the following pipe (|
) operator: https://github.com/reviewdog/action-rubocop/blob/master/script.sh#L96.
Can we fail the step in such case? Otherwise we risk to get not pleasant situation: the checks are green, we think our code is correct, but actually the code is not even checked.
I'm getting an error during execution. Can provide more details if needed.
I feel that Metrics / AbcSize
is the cause.
rubocop offensens
Offenses:
app/controllers/users_controller.rb:13:3: C: Metrics/AbcSize: Assignment Branch Condition size for create is too high. [<4, 28, 6> 28.91/25]
def create ...
^^^^^^^^^^
error
undefined method `begin' for nil:NilClass
/home/runner/work/_actions/reviewdog/action-rubocop/v2.1/rdjson_formatter/rdjson_formatter.rb:73:in `build_suggestions'
/home/runner/work/_actions/reviewdog/action-rubocop/v2.1/rdjson_formatter/rdjson_formatter.rb:59:in `build_diagnostic'
/home/runner/work/_actions/reviewdog/action-rubocop/v2.1/rdjson_formatter/rdjson_formatter.rb:21:in `block in file_finished'
/home/runner/work/_actions/reviewdog/action-rubocop/v2.1/rdjson_formatter/rdjson_formatter.rb:18:in `each'
/home/runner/work/_actions/reviewdog/action-rubocop/v2.1/rdjson_formatter/rdjson_formatter.rb:18:in `file_finished'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/formatter/formatter_set.rb:49:in `block in file_finished'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/formatter/formatter_set.rb:49:in `each'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/formatter/formatter_set.rb:49:in `file_finished'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/runner.rb:218:in `file_finished'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/runner.rb:127:in `process_file'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/runner.rb:101:in `block in each_inspected_file'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/runner.rb:100:in `each'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/runner.rb:100:in `reduce'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/runner.rb:100:in `each_inspected_file'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/runner.rb:86:in `inspect_files'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/runner.rb:47:in `run'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/cli/command/execute_runner.rb:25:in `execute_runner'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/cli/command/execute_runner.rb:17:in `run'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/cli/command.rb:11:in `run'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/cli/environment.rb:18:in `run'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/cli.rb:65:in `run_command'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/cli.rb:72:in `execute_runners'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/lib/rubocop/cli.rb:41:in `run'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/exe/rubocop:13:in `block in <top (required)>'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/2.6.0/benchmark.rb:308:in `realtime'
/opt/hostedtoolcache/Ruby/2.6.5/x64/lib/ruby/gems/2.6.0/gems/rubocop-0.92.0/exe/rubocop:12:in `<top (required)>'
/opt/hostedtoolcache/Ruby/2.6.5/x64/bin/rubocop:23:in `load'
/opt/hostedtoolcache/Ruby/2.6.5/x64/bin/rubocop:23:in `<main>'
workflow
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6.5
bundler-cache: true
- name: rubocop
uses: reviewdog/[email protected]
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-rspec:gemfile
reporter: github-pr-review
Installing rubocop
Installing rubocop with extensions ... https://github.com/rubocop/rubocop
Successfully installed unicode-display_width-1.8.0
Successfully installed ruby-progressbar-1.11.0
Successfully installed ast-2.4.2
Successfully installed parser-3.1.1.0
Successfully installed rubocop-ast-1.16.0
Successfully installed regexp_parser-2.2.1
Successfully installed rainbow-3.1.1
Successfully installed parallel-1.22.1
Successfully installed rubocop-0.92.0
9 gems installed
Successfully installed rubocop-rspec-1.[43](https://github.com/slogan-tech/fastgrow/runs/5765065621?check_suite_focus=true#step:4:43).2
I am adding code health checks to some of our repos, and I tried to use this action along with https://github.com/reviewdog/action-suggester. Of course it does not work, the suggester action expects to find a diff, not a linter output.
What would be the steps to support suggestions using this image? I can do the grunt work if I'm pointed in the right direction.
Hi,
I'm currently using this action for rubocop which is actually very nice.
But last week there was an update for rubocop-rails
which is automatically installed to the latest version in this action.
The rubocop-rails
gem is returning errors which currently causes that every time reviewdog runs the rubocop step fails.
Maybe you can make it possible to set versions of the used gems.
I'm getting an error during execution. Can provide more details if needed
undefined method `begin' for #<RuboCop::Cop::Offense::PseudoSourceRange:0x000055906792fa48>
Did you mean? begin_pos
/home/runner/work/_actions/reviewdog/action-rubocop/v2/rdjson_formatter/rdjson_formatter.rb:41:in `build_diagnostic'
Workflow config:
jobs:
rubocop:
name: rubocop
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.1
- name: rubocop
uses: reviewdog/action-rubocop@v2
with:
rubocop_version: 0.90.0
rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile
reporter: github-pr-review
fail_on_error: true
When running reviewdog/action-rubocop action, the suggestion for Rails/RedundantActiveRecordAllMethod
that appears in the pull request review is incorrect.
๐ [rubocop] <Rails/RedundantActiveRecordAllMethod> reported by reviewdog ๐ถ
Redundant all
detected.
User.find_by(1)
๐ [rubocop] <Rails/RedundantActiveRecordAllMethod> reported by reviewdog ๐ถ
Redundantall
detected.User..find_by(1)
Example: massongit#2
I run reviewdog/action-rubocop action with the following conditions:
rubocop-rails
github-pr-review
https://github.com/massongit/action-rubocop/actions/runs/7947724505/job/21696894186?pr=2
Successfully installed rubocop-ast-1.30.0
Successfully installed rexml-3.2.6
Successfully installed regexp_parser-2.9.0
Successfully installed rainbow-3.1.1
Successfully installed parallel-1.24.0
Successfully installed language_server-protocol-3.17.0.3
Successfully installed rubocop-1.60.2
11 gems installed
Successfully installed rack-3.0.9
Successfully installed ruby2_keywords-0.0.5
Successfully installed drb-2.2.0
Successfully installed base64-0.2.0
Successfully installed connection_pool-2.4.1
Successfully installed concurrent-ruby-1.2.3
Successfully installed tzinfo-2.0.6
Successfully installed i18n-1.14.1
Successfully installed activesupport-7.1.3
Successfully installed rubocop-rails-2.23.1
10 gems installed
Successfully installed rubocop-performance-1.20.2
1 gem installed
Successfully installed rubocop-factory_bot-2.25.1
Successfully installed rubocop-capybara-2.20.0
Successfully installed rubocop-rspec-2.26.1
3 gems installed
Successfully installed rubocop-i18n-3.0.0
1 gem installed
Successfully installed rubocop-rake-0.6.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.