gitlabhq/gitlabhq

View on GitHub

Showing 2,020 of 2,950 total issues

Method user_squash has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def user_squash(user, squash_id, start_sha, end_sha, author, message)
Severity: Minor
Found in lib/gitlab/gitaly_client/operation_service.rb - About 45 mins to fix

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

          def run(&block)
            raise 'no block given' unless block_given?
    
            @block = block
    
    
    Severity: Minor
    Found in lib/gitlab/database/with_lock_retries.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 disable_statement_timeout has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def disable_statement_timeout
            if block_given?
              if statement_timeout_disabled?
                # Don't do anything if the statement_timeout is already disabled
                # Allows for nested calls of disable_statement_timeout without
    Severity: Minor
    Found in lib/gitlab/database/migration_helpers.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 store_in_cache_if_needed has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def store_in_cache_if_needed
              return delete_from_cache unless commit
              return unless sha
              return unless ref
    
    
    Severity: Minor
    Found in lib/gitlab/cache/ci/project_pipeline_status.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 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def initialize(storage, service, rpc, request, remote_storage, timeout)
    Severity: Minor
    Found in lib/gitlab/gitaly_client/call.rb - About 45 mins to fix

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

              def validate!(command)
                return unless Rails.env.development? || Rails.env.test?
                return if allow_cross_slot_commands?
      
                command_name = command.first.to_s.upcase
      Severity: Minor
      Found in lib/gitlab/instrumentation/redis_cluster_validator.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 error_for_suggestion has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def error_for_suggestion(suggestion)
              unless suggestion.diff_file
                return _('A file was not found.')
              end
      
      
      Severity: Minor
      Found in lib/gitlab/suggestions/suggestion_set.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 lfs_token_check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def lfs_token_check(login, encoded_token, project)
              deploy_key_matches = login.match(/\Alfs\+deploy-key-(\d+)\z/)
      
              actor =
                if deploy_key_matches
      Severity: Minor
      Found in lib/gitlab/auth.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 find has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def find(repo, commit_id = "HEAD")
                # Already a commit?
                return commit_id if commit_id.is_a?(Gitlab::Git::Commit)
      
                # This saves us an RPC round trip.
      Severity: Minor
      Found in lib/gitlab/git/commit.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 diff has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def diff(from, to, options = {})
              from_id = case from
                        when NilClass
                          Gitlab::Git::EMPTY_TREE_ID
                        else
      Severity: Minor
      Found in lib/gitlab/gitaly_client/commit_service.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 execute has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.execute(import_path)
              unless import_path.ends_with?('/')
                import_path = "#{import_path}/"
              end
      
      
      Severity: Minor
      Found in lib/gitlab/bare_repository_import/importer.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 find_next_marker has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def find_next_marker(scanner)
                beginning_of_section_len = 8
                maybe_marker = scanner.exist?(beginning_of_section_regex)
      
                if maybe_marker.nil?
      Severity: Minor
      Found in lib/gitlab/ci/trace/section_parser.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 format_issue_comment_body has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def format_issue_comment_body(id, author, date, content, attachments, updates)
      Severity: Minor
      Found in lib/gitlab/fogbugz_import/importer.rb - About 45 mins to fix

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

                def get_xterm_color_class(command_stack, prefix)
                  # the 38 and 48 commands have to be followed by "5" and the color index
                  return unless command_stack.length >= 2
                  return unless command_stack[0] == "5"
        
        
        Severity: Minor
        Found in lib/gitlab/ci/ansi2html.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 validate_each has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                  def validate_each(record, attribute, value)
                    valid = validate_array_of_strings(value)
        
                    record.errors.add(attribute, 'should be an array of strings') unless valid
        
        
        Severity: Minor
        Found in lib/gitlab/config/entry/validators.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 process_count_commits_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def process_count_commits_options(options)
                if options[:from] || options[:to]
                  ref =
                    if options[:left_right] # Compare with merge-base for left-right
                      "#{options[:from]}...#{options[:to]}"
        Severity: Minor
        Found in lib/gitlab/git/repository.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 format_response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                def format_response(response)
                  response[:text] = format(response[:text]) if response.key?(:text)
        
                  if response.key?(:attachments)
                    response[:attachments].each do |attachment|
        Severity: Minor
        Found in lib/gitlab/slash_commands/presenters/base.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 format_issue_comment_body has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def format_issue_comment_body(id, author, date, content, updates, attachments)
        Severity: Minor
        Found in lib/gitlab/google_code_import/importer.rb - About 45 mins to fix

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

                  def inherit!(deps)
                    return unless deps
          
                    self.class.nodes.each do |key, factory|
                      next unless factory.inheritable?
          Severity: Minor
          Found in lib/gitlab/config/entry/inheritable.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 text has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def text
                    message = ["**#{status_text(resource)}**"]
          
                    if resource.upvotes.zero? && resource.downvotes.zero? && resource.user_notes_count.zero?
                      return message.join
          Severity: Minor
          Found in lib/gitlab/slash_commands/presenters/issue_show.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

          Severity
          Category
          Status
          Source
          Language