rubocop-hq/rubocop

View on GitHub
lib/rubocop/cop/style/arguments_forwarding.rb

Summary

Maintainability
C
1 day
Test Coverage
A
100%

File arguments_forwarding.rb has 277 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module RuboCop
  module Cop
    module Style
      # In Ruby 2.7, arguments forwarding has been added.
      #
Severity: Minor
Found in lib/rubocop/cop/style/arguments_forwarding.rb - About 2 hrs to fix

    Class SendNodeClassifier has 22 methods (exceeds 20 allowed). Consider refactoring.
    Open

            class SendNodeClassifier
              extend NodePattern::Macros
    
              # @!method forwarded_rest_arg?(node, rest_name)
              def_node_matcher :forwarded_rest_arg?, '(splat (lvar %1))'
    Severity: Minor
    Found in lib/rubocop/cop/style/arguments_forwarding.rb - About 2 hrs to fix

      Class ArgumentsForwarding has 21 methods (exceeds 20 allowed). Consider refactoring.
      Open

            class ArgumentsForwarding < Base
              include RangeHelp
              extend AutoCorrector
              extend TargetRubyVersion
      
      
      Severity: Minor
      Found in lib/rubocop/cop/style/arguments_forwarding.rb - About 2 hrs to fix

        Method add_forward_all_offenses has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

                def add_forward_all_offenses(node, send_classifications, forwardable_args)
                  _rest_arg, _kwrest_arg, block_arg = *forwardable_args
                  registered_block_arg_offense = false
        
                  send_classifications.each do |send_node, _c, forward_rest, forward_kwrest, forward_block_arg| # rubocop:disable Layout/LineLength
        Severity: Minor
        Found in lib/rubocop/cop/style/arguments_forwarding.rb - About 55 mins to fix

        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

        Method add_post_ruby_32_offenses has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def add_post_ruby_32_offenses(def_node, send_classifications, forwardable_args)
                  return unless use_anonymous_forwarding?
        
                  rest_arg, kwrest_arg, block_arg = *forwardable_args
        
        
        Severity: Minor
        Found in lib/rubocop/cop/style/arguments_forwarding.rb - About 45 mins to fix

        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

        Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                  def initialize(def_node, send_node, referenced_lvars, forwardable_args, **config)
        Severity: Minor
        Found in lib/rubocop/cop/style/arguments_forwarding.rb - About 35 mins to fix

          Method can_forward_all? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                    def can_forward_all?
                      return false if any_arg_referenced?
                      return false if ruby_32_missing_rest_or_kwest?
                      return false unless offensive_block_forwarding?
                      return false if additional_kwargs_or_forwarded_kwargs?
          Severity: Minor
          Found in lib/rubocop/cop/style/arguments_forwarding.rb - About 35 mins to fix

          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

          There are no issues that match your filters.

          Category
          Status