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

Fix bug with --auto-gen-config and RegexpLiteral #1126

Merged
merged 1 commit into from
May 30, 2014

Conversation

ggilder
Copy link
Contributor

@ggilder ggilder commented May 30, 2014

The RegexpLiteral cop stores a running tally of slashes found inside
regular expressions, which it uses to determine whether the
auto-generated config should disable the cop completely, or just specify
the maximum number of slashes to make the cop pass.

Previously this tally was stored in an instance variable. However, this
doesn't work when run against a project with multiple files, because a
new instance of the cop is created for each file. Thus, we need to store
the running tally in a class-level variable.

cc @tamird

The `RegexpLiteral` cop stores a running tally of slashes found inside
regular expressions, which it uses to determine whether the
auto-generated config should disable the cop completely, or just specify
the maximum number of slashes to make the cop pass.

Previously this tally was stored in an instance variable. However, this
doesn't work when run against a project with multiple files, because a
new instance of the cop is created for each file. Thus, we need to store
the running tally in a class-level variable.
@jonas054
Copy link
Collaborator

👍 Looks good! Thanks for fixing.

bbatsov added a commit that referenced this pull request May 30, 2014
…-gen

Fix bug with --auto-gen-config and RegexpLiteral
@bbatsov bbatsov merged commit b66fb66 into rubocop:master May 30, 2014
@ggilder ggilder deleted the ggilder/fix-regexp-literal-auto-gen branch May 30, 2014 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants