Is your feature request related to a problem? Please describe.
The Rails/SkipsModelValidations cop currently only mentions "validations" in its name, message, and documentation. However, the methods detected by this cop (such as update_column, update_all, touch, increment!, etc.) actually skip both validations and callbacks.
According to the official Rails guide on callbacks, these methods bypass callbacks.
Since skipping callbacks can have significant consequences, users should be made aware that callbacks are also skipped.
Describe the solution you'd like
Create a new separate cop Rails/SkipsModelCallbacks:
- Keep
Rails/SkipsModelValidations for validation-focused warnings
- Create a new
Rails/SkipsModelCallbacks cop specifically for callback-skipping warnings
- This provides more granular control, allowing users to enable/disable each concern independently
- Both cops would detect the same methods but with different messages and purposes
I would be happy to submit a PR for this if the approach is acceptable.
Describe alternatives you've considered
Alternative 1: Update documentation and message only (minimal change)
- Add "and callbacks" to the existing SkipsModelValidations message and documentation
- Simple but lacks granular control
Alternative 2: Rename the cop (breaking change)
- Rename to something like
Rails/SkipsModelValidationsAndCallbacks or Rails/SkipsActiveRecordFeatures
This would be a breaking change.
Additional context
Is your feature request related to a problem? Please describe.
The
Rails/SkipsModelValidationscop currently only mentions "validations" in its name, message, and documentation. However, the methods detected by this cop (such as update_column, update_all, touch, increment!, etc.) actually skip both validations and callbacks.According to the official Rails guide on callbacks, these methods bypass callbacks.
Since skipping callbacks can have significant consequences, users should be made aware that callbacks are also skipped.
Describe the solution you'd like
Create a new separate cop
Rails/SkipsModelCallbacks:Rails/SkipsModelValidationsfor validation-focused warningsRails/SkipsModelCallbackscop specifically for callback-skipping warningsI would be happy to submit a PR for this if the approach is acceptable.
Describe alternatives you've considered
Alternative 1: Update documentation and message only (minimal change)
Alternative 2: Rename the cop (breaking change)
Rails/SkipsModelValidationsAndCallbacksorRails/SkipsActiveRecordFeaturesThis would be a breaking change.
Additional context