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 #1935] Allow Symbol#to_proc blocks in Performance/Size #1936

Merged
merged 1 commit into from
Jun 5, 2015

Conversation

m1foley
Copy link

@m1foley m1foley commented Jun 2, 2015

This check should pass when passing a block to count, but Symbol#to_proc blocks were not being allowed like they should.

Fixes #1935

@jonas054
Copy link
Collaborator

jonas054 commented Jun 3, 2015

The heading of the commit message should start [Fix #1935].

@m1foley m1foley changed the title [#Fix 1935] Allow Symbol#to_proc blocks in Performance/Size [Fix #1935] Allow Symbol#to_proc blocks in Performance/Size Jun 3, 2015
@m1foley
Copy link
Author

m1foley commented Jun 3, 2015

Oops, fixed the commit message.

@m1foley m1foley force-pushed the size-sym-to-proc branch 2 times, most recently from e5c608f to 3bc06da Compare June 3, 2015 23:18
@m1foley
Copy link
Author

m1foley commented Jun 3, 2015

Added to CHANGELOG as well.

@bbatsov
Copy link
Collaborator

bbatsov commented Jun 4, 2015

The build is failing because of a couple of long lines.

@m1foley
Copy link
Author

m1foley commented Jun 4, 2015

I've fixed the spec descriptions that were > 80 chars. I can't figure out why coveralls is failing though; the file I changed is still at 100% coverage.

it 'does not register an offense when calling count with a to_proc block' do
inspect_source(cop, '[1, 2, 3].count(&:nil?)')

expect(cop.messages).to be_empty
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest checking cop.offenses instead as it's more natural.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. The rest of the spec still uses cop.messages though.

@bbatsov
Copy link
Collaborator

bbatsov commented Jun 4, 2015

You can ignore this. Just address my tiny remark and rebase on top of the current master.

This check should pass when passing a block to #count, but
Symbol#to_proc blocks were not being allowed like they should.
@m1foley
Copy link
Author

m1foley commented Jun 5, 2015

Rebased on master. Should be good to merge.

@bbatsov bbatsov merged commit cb73ce1 into rubocop:master Jun 5, 2015
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.

Performance/Size false positive: Array#count with Symbol#to_proc block
3 participants