Skip to content
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

Style/MethodDefParentheses only finds offense 1 per core #8514

Closed
emailrhoads opened this issue Aug 10, 2020 · 3 comments
Closed

Style/MethodDefParentheses only finds offense 1 per core #8514

emailrhoads opened this issue Aug 10, 2020 · 3 comments
Labels

Comments

@emailrhoads
Copy link

emailrhoads commented Aug 10, 2020

There is a strange issue that is occurring where when we run rubocop it only finds a few offenses each time. This is particularly annoying because it requires an iterative approach to resolve all issue.

Style/MethodDefParentheses appears to be the particular cop causing this problem.


Expected behavior

I expect the results for bundle exec rubocop to find all violation of all cops across all files

Actual behavior

When I run bundle exec rubocop, I get 1 offense
When I run bundle exec rubocop -P, I get 4 offenses (one for each core)

Steps to reproduce the problem

We are not using a Gemfile.lock in this instance (want latest versions of everything).

RuboCop version

Include the output of rubocop -V or bundle exec rubocop -V if using Bundler. Here's an example:

$ sudo bundle exec rubocop -V
0.89.1 (using Parser 2.7.1.4, rubocop-ast 0.3.0, running on ruby 2.5.7 x86_64-linux)
@emailrhoads emailrhoads changed the title Different results when running with sudo or -P flag Style/MethodDefParentheses only finds violation 1 per core Aug 10, 2020
@emailrhoads emailrhoads reopened this Aug 10, 2020
@emailrhoads emailrhoads changed the title Style/MethodDefParentheses only finds violation 1 per core Style/MethodDefParentheses only finds offense 1 per core Aug 10, 2020
@rpbaltazar
Copy link

rpbaltazar commented Aug 22, 2020

I'm also facing this. Also, I need to run with cache disabled otherwise it won't even detect anything else.

It's a bit silly, but i ended up by writing a bash script to run rubocop in a loop auto correcting the offenses:

# /bin/bash
x=0
while [ $x -eq 0 ]
do
  rubocop -C false -a | grep 'offense detected' &> /dev/null
  x=$?
  echo "Finished $x"
done
echo $x

https://gist.github.com/rpbaltazar/80f95c6deda17dbd06905c213cede041

@bbatsov bbatsov added the bug label Aug 22, 2020
@jsmestad
Copy link

jsmestad commented Sep 22, 2020

Wanted to say I am hitting this as well. Tried 0.90.1, 0.90.0 and 0.89.0 if that is helpful to see where the issue is.

To expand though I am seeing this with Layout/DotPosition and Layout/SpaceAroundEqualsInParameterDefault

@rdunlop
Copy link
Contributor

rdunlop commented Sep 30, 2020

@jsmestad I think that I may have a handle on this one too. see #8817

@koic koic closed this as completed in 0570df8 Oct 1, 2020
koic added a commit that referenced this issue Oct 1, 2020
…od_def_parentheses

[Fix #8514] Correct multiple Style/MethodDefParentheses per file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants