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/MutableConstant gives false positive on splat assignment #3366

Closed
Drenmi opened this issue Aug 4, 2016 · 0 comments
Closed

Style/MutableConstant gives false positive on splat assignment #3366

Drenmi opened this issue Aug 4, 2016 · 0 comments

Comments

@Drenmi
Copy link
Collaborator

Drenmi commented Aug 4, 2016

As per this StackOverflow post, when running this cop on a piece of code with a splat assignment, it incorrectly reports a violation.

Example:

FOO = *(1...10)

Expected behavior

No offenses are registered.

Actual behavior

C: Freeze mutable objects assigned to constants.
NUMS = *(1...10)
       ^^^^^^^^^

Steps to reproduce the problem

Run:

bundle exec rubocop --only Style/MutableConstant

on the above code.

RuboCop version

$ rubocop -V
0.42.0 (using Parser 2.3.1.2, running on ruby 2.3.0 x86_64-darwin15)
Drenmi added a commit to Drenmi/rubocop that referenced this issue Aug 5, 2016
…signments

This cop would generate false positives on code like:

```
FOO = *(1...10)
```

and:

```
BAR = *[1...10].freeze
```

This change fixes that.
@bbatsov bbatsov closed this as completed in f281575 Aug 5, 2016
Neodelf pushed a commit to Neodelf/rubocop that referenced this issue Oct 15, 2016
…signments (rubocop#3367)

This cop would generate false positives on code like:

```
FOO = *(1...10)
```

and:

```
BAR = *[1...10].freeze
```

This change fixes that.
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

No branches or pull requests

1 participant