bbatsov/rubocop

View on GitHub

Showing 644 of 684 total issues

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 '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 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 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 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 '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 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

                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

                  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 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 directive_offense_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def directive_offense_type(directive, actual_name)
                            return :missing_directive unless directive
                  
                            return :wrong_scope if wrong_scope(directive, actual_name)
                            return :no_scope if no_scope(directive, actual_name)
                  Severity: Minor
                  Found in lib/rubocop/cop/internal_affairs/node_matcher_directive.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

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

                        def elements(node)
                          return node.children unless node.call_type?
                  
                          node.arguments.flat_map do |argument|
                            # For each argument, if it is a multi-line hash without braces,
                  Severity: Minor
                  Found in lib/rubocop/cop/mixin/trailing_comma.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_negative_conditional has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def check_negative_conditional(node, message:, &block)
                          condition = node.condition
                  
                          return if empty_condition?(condition)
                  
                  
                  Severity: Minor
                  Found in lib/rubocop/cop/mixin/negative_conditional.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 extract_ruby_version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def extract_ruby_version(required_ruby_version)
                            return unless required_ruby_version
                  
                            if required_ruby_version.is_a?(Array)
                              required_ruby_version = required_ruby_version.detect do |v|
                  Severity: Minor
                  Found in lib/rubocop/cop/gemspec/required_ruby_version.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 run_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def run_command(server_command, detach:)
                          case server_command
                          when '--server'
                            Server::ClientCommand::Start.new(detach: detach).run unless Server.running?
                          when '--no-server'
                  Severity: Minor
                  Found in lib/rubocop/server/cli.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 autocorrect_enabled? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def autocorrect_enabled?
                          # allow turning off autocorrect on a cop by cop basis
                          return true unless cop_config
                  
                          # `false` is the same as `disabled` for backward compatibility.
                  Severity: Minor
                  Found in lib/rubocop/cop/autocorrect_logic.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 magic_comment_lines has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def magic_comment_lines
                            lines = [nil, nil]
                  
                            leading_magic_comments.each.with_index do |comment, index|
                              if comment.encoding_specified?
                  Severity: Minor
                  Found in lib/rubocop/cop/lint/ordered_magic_comments.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