Module: RuboCop::Cop::CodeLength
Overview
Common functionality for checking length of code segments.
Instance Method Summary
collapse
#max=, #max_parameter_name
Instance Method Details
#check_code_length(node) ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/rubocop/cop/mixin/code_length.rb', line 17
def check_code_length(node)
length = code_length(node)
return unless length > max_length
add_offense(node, :expression, message(length, max_length)) do
self.max = length
end
end
|
13
14
15
|
# File 'lib/rubocop/cop/mixin/code_length.rb', line 13
def
cop_config['CountComments']
end
|
#irrelevant_line(source_line) ⇒ Object
Returns true for lines that shall not be included in the count.
27
28
29
|
# File 'lib/rubocop/cop/mixin/code_length.rb', line 27
def irrelevant_line(source_line)
source_line.blank? || ! && (source_line)
end
|
#max_length ⇒ Object
9
10
11
|
# File 'lib/rubocop/cop/mixin/code_length.rb', line 9
def max_length
cop_config['Max']
end
|