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 #578] Add Rails/RedundantPresenceValidationOnBelongsTo cop #594

Conversation

pirj
Copy link
Member

@pirj pirj commented Dec 4, 2021

fix #578


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 (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.
  • 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.
  • [-] If this is a new cop, consider making a corresponding update to the Rails Style Guide.

@pirj
Copy link
Member Author

pirj commented Dec 4, 2021

  • Run bundle exec rake default. It executes all tests and RuboCop for itself, and generates the documentation.

It does not I'm afraid.
Also,

$ rake generate_cops_documentation
Updating the documentation is now done automatically!

doesn't do anything, too.
I would expect them to add cop's docs to docs/modules/ROOT/pages/cops_rails.adoc, but they didn't.
This happened recently in #586, too.
Is it generated when the release is cut, and <<next>> is replaced with a certain version?

@pirj pirj force-pushed the introduce-redundant-presence-validation-on-belongs_to branch 2 times, most recently from 98469e2 to cfcb90d Compare December 4, 2021 00:18
@koic
Copy link
Member

koic commented Dec 6, 2021

Ah, I removed the rake generate_cops_documentation obsolete task and tweaked the PR template.

Is it generated when the release is cut, and <<next>> is replaced with a certain version?

Yep! This repository automation follows the rubocop/rubocop core, so <<next>>, docs, and changelog will be updated when the release task runs.

@pirj pirj force-pushed the introduce-redundant-presence-validation-on-belongs_to branch from ee305dd to 9ba3591 Compare December 8, 2021 16:44
@pirj pirj requested a review from koic December 8, 2021 16:45
@pirj
Copy link
Member Author

pirj commented Dec 8, 2021

Green 🍏

# Match a class with a matching association, either by name or an explicit
# `foreign_key` option
#
# @example source that matches - fk matches `foreign_key` option
Copy link
Member

Choose a reason for hiding this comment

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

Can you align the indents of @example, @param, and @return to @!method?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't quite understand the note, but it appears that it's fine as is according to YARD doc. What do you think?

Note:

For backwards compatibility support, you do not need to indent the method's docstring text. If a @!method directive is seen with no indented block, the entire docstring is used as the new method's docstring text.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I get it. There is no problem. Thank you for the documentation link.

@pirj pirj force-pushed the introduce-redundant-presence-validation-on-belongs_to branch from 8ced32c to 301c7d4 Compare December 9, 2021 07:37
@koic koic merged commit 5b230e5 into rubocop:master Dec 10, 2021
@koic
Copy link
Member

koic commented Dec 10, 2021

Thanks!

@pirj pirj deleted the introduce-redundant-presence-validation-on-belongs_to branch December 10, 2021 09:58
@pirj pirj changed the title [Fix #587] Add Rails/RedundantPresenceValidationOnBelongsTo cop [Fix #578] Add Rails/RedundantPresenceValidationOnBelongsTo cop Dec 10, 2021
@pirj
Copy link
Member Author

pirj commented Dec 10, 2021

Sorry for messing up the original ticket number. Fixed the PR title.

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.

Cop idea: redundant presence validation on association
2 participants