bbatsov/rubocop

View on GitHub

Showing 647 of 687 total issues

Avoid too many return statements within this method.
Open

            return 'an expression'
Severity: Major
Found in lib/rubocop/cop/style/redundant_parentheses.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return if node.multiline? && allow_in_multiline_conditions?
    Severity: Major
    Found in lib/rubocop/cop/style/redundant_parentheses.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return if allow_if_method_has_argument?(node.send_node)
      Severity: Major
      Found in lib/rubocop/cop/style/symbol_proc.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return if allow_comments? && contains_comments?(node)
        Severity: Major
        Found in lib/rubocop/cop/style/symbol_proc.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return if allowed_method_name?(dispatch_node.method_name)
          Severity: Major
          Found in lib/rubocop/cop/style/symbol_proc.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return if node.block_type? && destructuring_block_argument?(arguments_node)
            Severity: Major
            Found in lib/rubocop/cop/style/symbol_proc.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return if begin_node.parent&.if_type? && begin_node.parent.ternary?
              Severity: Major
              Found in lib/rubocop/cop/style/redundant_parentheses.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return if node.semantic_operator? && begin_node.parent
                Severity: Major
                Found in lib/rubocop/cop/style/redundant_parentheses.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                            return true if delimiter?(node, escaped[0])
                  Severity: Major
                  Found in lib/rubocop/cop/style/redundant_string_escape.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                              return 'an interpolated expression' if interpolation?(begin_node)
                    Severity: Major
                    Found in lib/rubocop/cop/style/redundant_parentheses.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                return if begin_node.chained?
                      Severity: Major
                      Found in lib/rubocop/cop/style/redundant_parentheses.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return unless begin_node.parent.nil?
                        Severity: Major
                        Found in lib/rubocop/cop/style/redundant_parentheses.rb - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return if ALLOWED_NODE_TYPES.include?(begin_node.parent&.type)
                          Severity: Major
                          Found in lib/rubocop/cop/style/redundant_parentheses.rb - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                      return if exist_argument_between_heredoc_end_and_closing_parentheses?(node)
                            Severity: Major
                            Found in lib/rubocop/cop/layout/heredoc_argument_closing_parenthesis.rb - About 30 mins to fix

                              Method cleanup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def self.cleanup(config_store, verbose, cache_root = nil)
                                    return if inhibit_cleanup # OPTIMIZE: For faster testing
                              
                                    cache_root ||= cache_root(config_store)
                                    return unless File.exist?(cache_root)
                              Severity: Minor
                              Found in lib/rubocop/result_cache.rb - About 25 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 references has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def references(cop, see_objects) # rubocop:disable Metrics/AbcSize
                                  cop_config = config.for_cop(cop)
                                  urls = RuboCop::Cop::MessageAnnotator.new(config, cop.name, cop_config, {}).urls
                                  return '' if urls.empty? && see_objects.empty?
                              
                              
                              Severity: Minor
                              Found in lib/rubocop/cops_documentation_generator.rb - About 25 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 find_target_line has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                      def find_target_line
                                        configuration_entries.find.with_index do |line, index|
                                          next unless cop_name_line?(line)
                              
                                          return index if badge.to_s < line
                              Severity: Minor
                              Found in lib/rubocop/cop/generator/configuration_injector.rb - About 25 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 on_send has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                      def on_send(node)
                                        return unless cop_class_name
                                        return unless (config_name_node = cop_config_accessor?(node))
                                        return if always_allowed?(config_name_node)
                                        return if configuration_key_defined?(config_name_node)
                              Severity: Minor
                              Found in lib/rubocop/cop/internal_affairs/undefined_config.rb - About 25 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 move_pos has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def move_pos(src, pos, step, condition, regexp)
                                      offset = step == -1 ? -1 : 0
                                      pos += step while condition && regexp.match?(src[pos + offset])
                                      pos.negative? ? 0 : pos
                                    end
                              Severity: Minor
                              Found in lib/rubocop/cop/mixin/range_help.rb - About 25 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 check_alignment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def check_alignment(items, base_column = nil)
                                      base_column ||= display_column(items.first.source_range) unless items.empty?
                              
                                      each_bad_alignment(items, base_column) do |current|
                                        expr = current.source_range
                              Severity: Minor
                              Found in lib/rubocop/cop/mixin/alignment.rb - About 25 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

                              Severity
                              Category
                              Status
                              Source
                              Language