Class: AvoCli::Rules::FieldsAsClassMethods

Inherits:
Base
  • Object
show all
Defined in:
lib/avo_cli/rules/fields_as_class_methods.rb

Constant Summary collapse

MESSAGE =
"You should not use the `field` method as a class method. Please add it in the `def fields` method or use composition in other methods."

Instance Method Summary collapse

Instance Method Details

#applyObject



4
5
6
7
8
9
10
11
12
13
# File 'lib/avo_cli/rules/fields_as_class_methods.rb', line 4

def apply
  get_class_body.each do |node|
    if node.instance_of?(Prism::CallNode) && node.name == :field
      error_out(
        message:,
        node:,
      )
    end
  end
end