Showing 441 of 441 total issues
File rubocop.rb
has 661 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'English'
before_us = $LOADED_FEATURES.dup
require 'rainbow'
require 'set'
Class Base
has 53 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Base # rubocop:disable Metrics/ClassLength
extend RuboCop::AST::Sexp
extend NodePattern::Macros
extend ExcludeLimit
include RuboCop::AST::Sexp
File conditional_assignment.rb
has 420 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module RuboCop
module Cop
module Style
# Helper module to provide common methods to classes needed for the
# ConditionalAssignment Cop.
File options.rb
has 415 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'optparse'
require 'shellwords'
module RuboCop
class IncorrectCopNameError < StandardError; end
Class SpaceAroundKeyword
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class SpaceAroundKeyword < Base
extend AutoCorrector
MSG_BEFORE = 'Space before keyword `%<range>s` is missing.'
MSG_AFTER = 'Space after keyword `%<range>s` is missing.'
Class Runner
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Runner # rubocop:disable Metrics/ClassLength
# An exception indicating that the inspection loop got stuck correcting
# offenses back and forth.
class InfiniteCorrectionLoop < RuntimeError
attr_reader :offenses
Class Registry
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Registry
include Enumerable
attr_reader :options
Class Config
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Config
include PathUtil
include FileFinder
extend Forwardable
Class IndentationWidth
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class IndentationWidth < Cop # rubocop:disable Metrics/ClassLength
include EndKeywordAlignment
include Alignment
include CheckAssignment
include IgnoredPattern
Class BlockDelimiters
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class BlockDelimiters < Base
include ConfigurableEnforcedStyle
include IgnoredMethods
extend AutoCorrector
Class VariableForce
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class VariableForce < Force # rubocop:disable Metrics/ClassLength
VARIABLE_ASSIGNMENT_TYPE = :lvasgn
REGEXP_NAMED_CAPTURE_TYPE = :match_with_lvasgn
VARIABLE_ASSIGNMENT_TYPES =
[VARIABLE_ASSIGNMENT_TYPE, REGEXP_NAMED_CAPTURE_TYPE].freeze
Class RedundantParentheses
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class RedundantParentheses < Base
include Parentheses
extend AutoCorrector
def_node_matcher :square_brackets?,
Class ConfigLoader
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ConfigLoader
DOTFILE = '.rubocop.yml'
XDG_CONFIG = 'config.yml'
RUBOCOP_HOME = File.realpath(File.join(File.dirname(__FILE__), '..', '..'))
DEFAULT_FILE = File.join(RUBOCOP_HOME, 'config', 'default.yml')
Class HeredocArgumentClosingParenthesis
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class HeredocArgumentClosingParenthesis < Base
include RangeHelp
extend AutoCorrector
MSG = 'Put the closing parenthesis for a method call with a ' \
File runner.rb
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'parallel'
module RuboCop
# This class handles the processing of files, which includes dealing with
# formatters and letting cops inspect the files.
Class MethodCallWithArgsParentheses
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class MethodCallWithArgsParentheses
# Style omit_parentheses
module OmitParentheses
TRAILING_WHITESPACE_REGEX = /\s+\Z/.freeze
OMIT_MSG = 'Omit parentheses for method calls with arguments.'
Class Team
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Team
attr_reader :errors, :warnings, :updated_source_file, :cops
alias updated_source_file? updated_source_file
Class LineLength
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class LineLength < Base
include CheckLineBreakable
include IgnoredPattern
include RangeHelp
include LineLengthHelp
Method on_send
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
def on_send(node)
return unless struct_new(node) do
node.arguments.each_with_index do |arg, index|
# Ignore if the first argument is a class name
next if index.zero? && arg.str_type?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Class CopsDocumentationGenerator
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class CopsDocumentationGenerator # rubocop:disable Metrics/ClassLength
include ::RuboCop::Cop::Documentation
# This class will only generate documentation for cops that belong to one of
# the departments given in the `departments` array. E.g. if we only wanted
# documentation for Lint cops: