Class: RuboCop::Cop::InternalAffairs::MissingCopDepartment
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::InternalAffairs::MissingCopDepartment
- Defined in:
- lib/rubocop/cop/internal_affairs/missing_cop_department.rb
Overview
Enforces the use of explicit department names for cop rules.
Constant Summary collapse
- MSG =
'Define a proper department. Using `Cop/` as department is discourged.'
- COP_DEPARTMENT =
'Cop'
Instance Method Summary collapse
Instance Method Details
#on_class(node) ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/rubocop/cop/internal_affairs/missing_cop_department.rb', line 49 def on_class(node) namespace = full_namespace(node) # Skip top-level RuboCop::Cop names = namespace.drop(2) add_offense(node.loc.name) if names.size < 2 || names.first == COP_DEPARTMENT end |