We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Rails/SkipsModelValidations
Rails/SkipsModelValidations to not match on String#insert when the object has safe navigation.
String#insert
Offenses: title.rb:14:18: C: Rails/SkipsModelValidations: Avoid using insert because it skips validations. @title_str&.insert(0, 'Prefixed')
class Title def initialize(title_str) @title_str = title_str end def prefixed_title @title_str.insert(0, 'Prefixed') end def safe_nav_gated_prefixed_title @title_str&.insert(0, 'Prefixed') end end
❯ be rubocop -V 1.63.5 (using Parser 3.3.1.0, rubocop-ast 1.31.3, running on ruby 3.2.2) [arm64-darwin22] - rubocop-factory_bot 2.25.1 - rubocop-rails 2.24.1 - rubocop-rspec 2.29.2 - rubocop-rspec_rails 2.28.3
The text was updated successfully, but these errors were encountered:
[Fix rubocop#1278] Fix a false positivie for Rails/SkipsModelValidations
997cf75
eaedb72
40d9dc3
Merge pull request #1279 from tldn0718/fix-skip-model-validation-safe…
171e6de
…-navigator [Fix #1278] Fix a false positivie for Rails/SkipsModelValidations
dd6f545
Successfully merging a pull request may close this issue.
Expected behavior
Rails/SkipsModelValidations
to not match onString#insert
when the object has safe navigation.Actual behavior
Steps to reproduce the problem
RuboCop version
The text was updated successfully, but these errors were encountered: