Skip to content

Do not add validation danger comment to new model files

Abdul Wadood requested to merge 340144-no-comment-new-model-files into master

What does this MR do and why?

This is a follow-up of !126305 (merged) because the validation comments were being added to new model files as well. See #340144 (comment 1490280570).

The danger comment for validation is not useful for model files as they would have no records. But for model concerns the comment will be added as a new concern can be added to an existing model.

Screenshots or screen recordings

See !126305 (merged)

How to set up and validate locally

  1. Add validations in the following files
    1. New model
    2. New model concern
    3. Existing model
  2. Run bin/rake danger_local which should give the following message for new concern and existing model but not for the new model:
bin/rake danger_local
Results:

Markdown:

app/models/user.rb#L302

Did you consider new validations can break existing records?
Please follow the [code quality guidelines](https://docs.gitlab.com/ee/development/code_review.html#quality) when adding a new model validation.
If you're adding the validations to a model with no records you can ignore this warning.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #340144 (closed)

Merge request reports