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 false negatives in Rails/NotNullColumn cop #3508

Merged
merged 1 commit into from
Sep 19, 2016

Conversation

pocke
Copy link
Collaborator

@pocke pocke commented Sep 19, 2016

Rails/NotNullColumn should register an offence for the following code.

add_column :users, :email, :string, null: false, default: nil

However, the cop currently doesn't register.

This PR solves the problem.


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).
  • Used the same coding conventions as the rest of the project.
  • 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.
  • All tests are passing.
  • The new code doesn't generate RuboCop offenses.
  • The PR relates to only one subject with a clear title
    and description in grammatically correct, complete sentences.

@pocke pocke force-pushed the not-null-column-cop-default-nil branch from 17990cb to be2c3cf Compare September 19, 2016 05:29
@bbatsov
Copy link
Collaborator

bbatsov commented Sep 19, 2016

Looks good, but you'll have to rebase the PR.

@pocke pocke force-pushed the not-null-column-cop-default-nil branch from be2c3cf to 8c5898a Compare September 19, 2016 05:56
@pocke
Copy link
Collaborator Author

pocke commented Sep 19, 2016

Rebased

@bbatsov bbatsov merged commit 221a9bf into rubocop:master Sep 19, 2016
@bbatsov
Copy link
Collaborator

bbatsov commented Sep 19, 2016

👍 Thanks!

@pocke pocke deleted the not-null-column-cop-default-nil branch September 19, 2016 07:23
mikezter added a commit to mikezter/rubocop that referenced this pull request Sep 28, 2016
* bbatsov/master: (80 commits)
  [Fix rubocop#3540] Make `Style/GuardClause` register offense for instance & singleton methods
  [Fix rubocop#3436] issue related to Rails/SaveBang when returning non-bang call from the parent method
  Allow `#to_yml` to produce single-quoted strings
  Add support for StyleGuideBaseURL and update rules
  Add spec for the existing style guide URL implementation
  Fix the changelog
  Edited regular expression for normal case to fix issues rubocop#3514 and rubocop#3516 (rubocop#3524)
  Add a rake task for generation a new cop (rubocop#3533)
  [Fix rubocop#3510] Various bug fixes for SafeNavigation (rubocop#3517)
  [Fix rubocop#3512] Change error message of `Lint/UnneededSplatExpansion` for array (rubocop#3526)
  Fix false positive in `Lint/AssignmentInCondition` (rubocop#3520) (rubocop#3529)
  Rename a mismatched filename (rubocop#3523)
  Fix a broken changelog entry
  [Fix rubocop#3511] Style/TernaryParentheses false positive (rubocop#3513)
  Fix the release notes for 0.43
  Cut 0.43.0
  [Fix rubocop#3462] Don't flag single-line methods
  Fix false negatives in `Rails/NotNullColumn` cop (rubocop#3508)
  Remove unused doubled methods (rubocop#3509)
  [Fix rubocop#3485] Make OneLineConditional cop ignore empty else (rubocop#3487)
  ...
Neodelf pushed a commit to Neodelf/rubocop that referenced this pull request Oct 15, 2016
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.

2 participants