Sha256: 5e145cb0529d926bbe64ff648561e4c8a8a9b0e8e26057cd1ceed40d9004bd23
Contents?: true
Size: 875 Bytes
Versions: 6832
Compression:
Stored size: 875 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 location = node.casgn_type? ? :name : :expression add_offense(node, location: location, 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
6,832 entries across 6,807 versions & 28 rubygems