Showing 615 of 655 total issues
Class IfUnlessModifier
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class IfUnlessModifier < Base
include StatementModifier
include LineLengthHelp
include AllowedPattern
include RangeHelp
Class Team
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Team
# @return [Team]
def self.new(cop_or_classes, config, options = {})
# Support v0 api:
return mobilize(cop_or_classes, config, options) if cop_or_classes.first.is_a?(Class)
Class SpaceAroundOperators
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class SpaceAroundOperators < Base
include PrecedingFollowingAlignment
include RangeHelp
include RationalLiteral
extend AutoCorrector
Class EmptyLineBetweenDefs
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class EmptyLineBetweenDefs < Base
include RangeHelp
extend AutoCorrector
MSG = 'Expected %<expected>s between %<type>s definitions; found %<actual>d.'
Class TargetFinder
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class TargetFinder
HIDDEN_PATH_SUBSTRING = "#{File::SEPARATOR}."
def initialize(config_store, options = {})
@config_store = config_store
Method find_previous_older_sibling
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Open
def find_previous_older_sibling(node) # rubocop:disable Metrics
search_node(node).left_siblings.reverse.find do |sibling|
next unless sibling.is_a?(AST::Node)
sibling = sibling_node(sibling)
- 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 RedundantCondition
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class RedundantCondition < Base
include RangeHelp
extend AutoCorrector
MSG = 'Use double pipes `||` instead.'
Class SafeNavigation
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class SafeNavigation < Base
include NilMethods
include RangeHelp
extend AutoCorrector
extend TargetRubyVersion
Class LineLength
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class LineLength < Base
include CheckLineBreakable
include AllowedPattern
include RangeHelp
include LineLengthHelp
Class Changelog
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Changelog
ENTRIES_PATH = 'changelog/'
FIRST_HEADER = /#{Regexp.escape("## master (unreleased)\n")}/m.freeze
ENTRIES_PATH_TEMPLATE = "#{ENTRIES_PATH}%<type>s_%<name>s.md"
TYPE_REGEXP = /#{Regexp.escape(ENTRIES_PATH)}([a-z]+)_/.freeze
Class FileName
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class FileName < Base
include RangeHelp
MSG_SNAKE_CASE = 'The name of this source file (`%<basename>s`) should use snake_case.'
MSG_NO_DEFINITION = '`%<basename>s` should define a class or module called `%<namespace>s`.'
Class ConditionalAssignment
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ConditionalAssignment < Base
include ConditionalAssignmentHelper
include ConfigurableEnforcedStyle
include IgnoredNode
extend AutoCorrector
File arguments_forwarding.rb
has 277 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
module RuboCop
module Cop
module Style
# In Ruby 2.7, arguments forwarding has been added.
#
Method each_already_disabled
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
Open
def each_already_disabled(cop, line_ranges)
line_ranges.each_cons(2) do |previous_range, range|
next if ignore_offense?(range)
# If a cop is disabled in a range that begins on the same line as
# the end of the previous range, it means that the cop was
- 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 InclusiveLanguage
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class InclusiveLanguage < Base
include RangeHelp
extend AutoCorrector
EMPTY_ARRAY = [].freeze
Class ConfigLoader
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ConfigLoader
DOTFILE = ConfigFinder::DOTFILE
RUBOCOP_HOME = File.realpath(File.join(File.dirname(__FILE__), '..', '..'))
DEFAULT_FILE = File.join(RUBOCOP_HOME, 'config', 'default.yml')
Class SoleNestedConditional
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class SoleNestedConditional < Base
include RangeHelp
extend AutoCorrector
MSG = 'Consider merging nested conditions into outer `%<conditional_type>s` conditions.'
Class Next
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Next < Base
include ConfigurableEnforcedStyle
include MinBodyLength
include RangeHelp
extend AutoCorrector
Class MultilineMethodCallIndentation
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class MultilineMethodCallIndentation < Base
include ConfigurableEnforcedStyle
include Alignment
include MultilineExpressionIndentation
extend AutoCorrector
Class DirectiveComment
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class DirectiveComment
# @api private
LINT_DEPARTMENT = 'Lint'
# @api private
LINT_REDUNDANT_DIRECTIVE_COP = "#{LINT_DEPARTMENT}/RedundantCopDisableDirective"