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 376] Fix redunctantAllowNil false positive offense #394

Merged
merged 1 commit into from
Nov 30, 2020

Conversation

ngouy
Copy link
Contributor

@ngouy ngouy commented Nov 28, 2020

Fix 367

The issue occurs because we are checking the presence of allow_nil and allow_blank within the whole node tree
What we need to do is to check only the presence of this both when they are used on the same helper / level

If you want a specific message depending on the helper, it makes sense to have one or the other in different helpers of the same validation (CF issue)


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.

@ngouy ngouy marked this pull request as ready for review November 28, 2020 22:54
@ngouy ngouy changed the title [Fix 376] Fix redunctantAllowNil false offense when used on 2 validation helpers [Fix 376] Fix redunctantAllowNil false positive offense Nov 30, 2020
@koic koic merged commit f5df528 into rubocop:master Nov 30, 2020
@koic
Copy link
Member

koic commented Nov 30, 2020

Thanks!

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.

Rails/RedundantAllowNil Cop gives false positives under some specific scenarios.
2 participants