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 issues with Lint/UnmodifiedReduceAccumulator #8949

Merged
merged 1 commit into from Oct 28, 2020

Conversation

dvandersluis
Copy link
Member

Fix for issues brought up after merge in #8916 (please see discussion there).


Before submitting the PR make sure the following are checked:

  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the Changelog if the new code introduces user-observable changes. See changelog entry format.
  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

@dvandersluis
Copy link
Member Author

Still unresolved: given that checking for returning an index of the accumulator might be a false positive, how should we proceed?

I see a few options:
  1. We can remove this behaviour (I think this isn't ideal, because I do think this is still a good check)
  2. We can put it behind a conf variable that is not enabled by default
  3. We can accept the false positives (if this was my code I'd just # rubocop:disable it, but maybe that's suboptimal).

@bbatsov
Copy link
Collaborator

bbatsov commented Oct 27, 2020

We can accept the false positives (if this was my code I'd just # rubocop:disable it, but maybe that's suboptimal).

I have a feeling there won't be many of those, so we can launch the cop and see what kind of feedback we'll get.

@dvandersluis
Copy link
Member Author

dvandersluis commented Oct 27, 2020

@bbatsov not sure what to do for that ruby 2.4 spec failure? I ran it locally on 2.4 and it passes, and it doesn't seem to be about code I've changed here. Never mind it passed after rebasing master.

- Moved file to correct filename
- Made examples more descriptive
- Fixed not apply when reduce called with no argument or no block arguments
- Fixed false positives when the element is modified by another value
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.

None yet

2 participants