Skip to content

Commit

Permalink
Merge pull request #1287 from koic/mark_rails_skips_model_validations…
Browse files Browse the repository at this point in the history
…_as_unsafe

[Fix #1286] Mark `Rails/SkipsModelValidations` as unsafe
  • Loading branch information
koic authored May 28, 2024
2 parents 6c55cb6 + 44747ec commit afcf639
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#1286](https://github.com/rubocop/rubocop-rails/issues/1286): Mark `Rails/SkipsModelValidations` as unsafe. ([@koic][])
3 changes: 2 additions & 1 deletion config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1018,8 +1018,9 @@ Rails/SkipsModelValidations:
See reference for more information.
Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
Enabled: true
Safe: false
VersionAdded: '0.47'
VersionChanged: '2.7'
VersionChanged: '<<next>>'
ForbiddenMethods:
- decrement!
- decrement_counter
Expand Down
3 changes: 3 additions & 0 deletions lib/rubocop/cop/rails/skips_model_validations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ module Rails
#
# Methods may be ignored from this rule by configuring a `AllowedMethods`.
#
# @safety
# This cop is unsafe if the receiver object is not an Active Record object.
#
# @example
# # bad
# Article.first.decrement!(:view_count)
Expand Down

0 comments on commit afcf639

Please sign in to comment.