Rubocop: auto-gen-config skips Use the return of the conditional for variable assignment and comparison

Created on 29 Mar 2017  路  5Comments  路  Source: rubocop-hq/rubocop

Expected behavior

After running auto-gen-config for a repository that has errors for RuboCop::Cop::Style::ConditionalAssignment I expect it to add those particular errors to the rubocop_todo.yml

Actual behavior

Those errors are not added to the todo.yml

Steps to reproduce the problem

Run rubocop --auto-gen-config against a repository that has RuboCop::Cop::Style::ConditionalAssignment errors

RuboCop version

$ rubocop -V
0.48.0 (using Parser 2.4.0.0, running on ruby 2.2.1 x86_64-darwin14)
enhancement

All 5 comments

I believe this is the same as #4142. Have you been able to isolate an example under which this happens @kyprifog? It seems to work for some files, but not for others, and we're trying to figure out what differs between them. Any input could be valuable. 馃檪

Ahh, good catch thanks. I haven't noticed any pattern, it appears to be every instance of that violation but I could be wrong. If I get a chance I'll try to debug later.

@kyprifog @Drenmi I faced the similar issue.
Running rubocop --auto-gen-config didn't include all the files in todo.
And so on running rubocop I got some offenses.

Style/ConditionalAssignment is one of those cops that depend on Metrics/LineLength, which I guess is the source of the trouble with --auto-gen-config. The problem is that the current settings in .rubocop_todo.yml are not taken into account when regenerating the file. Thus Metrics/LineLength: Max is 80, which can cause some offenses to go away. I'm trying to come up with a solution that runs --auto-gen-config in several phases. Nothing finished yet.

I'm pretty sure this was solved by #4985. @kyprifog Please open again if the problem is still reproducible on latest gem version or master.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aqualon picture Aqualon  路  3Comments

NobodysNightmare picture NobodysNightmare  路  3Comments

lepieru picture lepieru  路  3Comments

mikegee picture mikegee  路  3Comments

ecbrodie picture ecbrodie  路  3Comments