app/controllers/job_categories_controller.rb
Do not prefix reader method names with get_
. Open
Open
def get_category
- Read upRead up
- Exclude checks
This cop makes sure that accessor methods are named properly. Applies to both instance and class methods.
NOTE: Offenses are only registered for methods with the expected
arity. Getters (get_attribute
) must have no arguments to be
registered, and setters (set_attribute(value)
) must have exactly
one.
Example:
# bad
def set_attribute(value)
end
# good
def attribute=(value)
end
# bad
def get_attribute
end
# good
def attribute
end
# accepted, incorrect arity for getter
def get_value(attr)
end
# accepted, incorrect arity for setter
def set_value
end
Missing top-level documentation comment for class JobCategoriesController
. Open
Open
class JobCategoriesController < ApplicationController
- Read upRead up
- Exclude checks
This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, constant definitions or constant visibility declarations.
The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.
Example:
# bad
class Person
# ...
end
module Math
end
# good
# Description/Explanation of Person class
class Person
# ...
end
# allowed
# Class without body
class Person
end
# Namespace - A namespace can be a class or a module
# Containing a class
module Namespace
# Description/Explanation of Person class
class Person
# ...
end
end
# Containing constant visibility declaration
module Namespace
class Private
end
private_constant :Private
end
# Containing constant definition
module Namespace
Public = Class.new
end
# Macro calls
module Namespace
extend Foo
end
Example: AllowedConstants: ['ClassMethods']
# good
module A
module ClassMethods
# ...
end
end