Sha256: 86b17e57c60da3f1e03ce84024c54c513b122cd665fe90d3da4d97c04eb6691d
Contents?: true
Size: 769 Bytes
Versions: 14
Compression:
Stored size: 769 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking length of code segments. module CodeLength include ConfigurableMax private def max_length cop_config['Max'] end def count_comments? cop_config['CountComments'] end def check_code_length(node) length = code_length(node) return unless length > max_length add_offense(node, message: message(length, max_length)) do self.max = length end end # Returns true for lines that shall not be included in the count. def irrelevant_line(source_line) source_line.blank? || !count_comments? && comment_line?(source_line) end end end end
Version data entries
14 entries across 14 versions & 2 rubygems