Class: Shirobai::Cop::Rails::DeprecatedActiveModelErrorsMethods
- Inherits:
-
RuboCop::Cop::Base
- Object
- RuboCop::Cop::Base
- Shirobai::Cop::Rails::DeprecatedActiveModelErrorsMethods
- Extended by:
- RuboCop::Cop::AutoCorrector
- Includes:
- RuboCop::Cop::RangeHelp, CandidateSupport
- Defined in:
- lib/shirobai/cop/rails/deprecated_active_model_errors_methods.rb
Overview
Drop-in Rust-backed reimplementation of
Rails/DeprecatedActiveModelErrorsMethods (rubocop-rails 2.35.5),
Architecture B.
Rust supplies candidate SEND ranges (the five errors-chain shapes:
errors[...]/errors.messages[...]/errors.details[...] manipulation
and assignment, and errors.{keys,values,to_h,to_xml}); this wrapper
relocates each parser send node and runs stock's on_send (renamed
investigate_send) plus autocorrect VERBATIM. The receiver-model
heuristic (model_file?), the Rails <= 6.0 gate on the incompatible
methods, skip_autocorrect? (uncorrectable details << ...) and the
receiver-walk offense range all run on the parser AST, so offenses and
-A bytes match stock exactly.
Constant Summary collapse
- MSG =
'Avoid manipulating ActiveModel errors as hash directly.'- AUTOCORRECTABLE_METHODS =
%i[<< clear keys].freeze
- INCOMPATIBLE_METHODS =
%i[keys values to_h to_xml].freeze
- MANIPULATIVE_METHODS =
Set[ *%i[ << append clear collect! compact! concat delete delete_at delete_if drop drop_while fill filter! keep_if flatten! insert map! pop prepend push reject! replace reverse! rotate! select! shift shuffle! slice! sort! sort_by! uniq! unshift ] ].freeze
Class Method Summary collapse
Methods included from CandidateSupport
Class Method Details
.badge ⇒ Object
40 |
# File 'lib/shirobai/cop/rails/deprecated_active_model_errors_methods.rb', line 40 def self.badge = RuboCop::Cop::Badge.parse(cop_name) |
.bundle_args(_config) ⇒ Object
42 43 44 |
# File 'lib/shirobai/cop/rails/deprecated_active_model_errors_methods.rb', line 42 def self.bundle_args(_config) [] end |
.cop_name ⇒ Object
39 |
# File 'lib/shirobai/cop/rails/deprecated_active_model_errors_methods.rb', line 39 def self.cop_name = "Rails/DeprecatedActiveModelErrorsMethods" |