Do not add validation danger comment to new model files
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
- Add validations in the following files
- New model
- New model concern
- Existing model
- 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.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #340144 (closed)