Sha256: 006557d487f701bc494a8e13ba182b2a8368d36c4e05e1e734eeece3803a0270
Contents?: true
Size: 923 Bytes
Versions: 6834
Compression:
Stored size: 923 Bytes
Contents
# frozen_string_literal: true module RuboCop module Cop # Common functionality for checking length of classes and modules. module ClassishLength include CodeLength private def code_length(node) body_line_numbers = line_range(node).to_a[1...-1] target_line_numbers = body_line_numbers - line_numbers_of_inner_nodes(node, :module, :class) target_line_numbers.reduce(0) do |length, line_number| source_line = processed_source[line_number] next length if irrelevant_line(source_line) length + 1 end end def line_numbers_of_inner_nodes(node, *types) line_numbers = Set.new node.each_descendant(*types) do |inner_node| line_range = line_range(inner_node) line_numbers.merge(line_range) end line_numbers.to_a end end end end
Version data entries
6,834 entries across 6,809 versions & 28 rubygems