gitlabhq/gitlabhq

View on GitHub

Showing 2,020 of 2,950 total issues

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

    def groups(highlight: true)
      prev_sha = nil
      groups = []
      current_group = nil

Severity: Minor
Found in lib/gitlab/blame.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 save has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def save(provider = 'OAuth')
          raise SigninDisabledForProviderError if oauth_provider_disabled?
          raise SignupDisabledError unless gl_user

          block_after_save = needs_blocking?
Severity: Minor
Found in lib/gitlab/auth/o_auth/user.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 consume_relation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def consume_relation(importable_path, key)
          Enumerator.new do |documents|
            next unless @consumed_relations.add?("#{importable_path}/#{key}")

            # This reads from `tree/project/merge_requests.ndjson`
Severity: Minor
Found in lib/gitlab/import_export/json/ndjson_reader.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 extensions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def extensions
        EXTENSION_MUTEX.synchronize do
          strong_memoize(:extensions) do
            Set.new.tap do |set|
              YAML.load_file(Rails.root.join('vendor', 'languages.yml')).each do |_name, details|
Severity: Minor
Found in lib/gitlab/language_data.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 map_line_number has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def map_line_number(from_line, from:, to:)
        # If no diff file could be found, the file wasn't changed, and the
        # mapped line number is the same as the specified line number.
        return from_line unless diff_file

Severity: Minor
Found in lib/gitlab/diff/line_mapper.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 select_body has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def select_body(message)
        part =
          if message.multipart?
            message.text_part || message.html_part || message
          else
Severity: Minor
Found in lib/gitlab/email/reply_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 find_user_from_job_token has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def find_user_from_job_token
        return unless route_authentication_setting[:job_token_allowed]
        return find_user_from_basic_auth_job if route_authentication_setting[:job_token_allowed] == :basic_auth

        token = current_request.params[JOB_TOKEN_PARAM].presence ||
Severity: Minor
Found in lib/gitlab/auth/auth_finders.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 each_object_to_import has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def each_object_to_import
        repo = project.import_source

        # We inject the page number here to make sure that all importers always
        # start where they left off. Simply starting over wouldn't work for
Severity: Minor
Found in lib/gitlab/github_import/parallel_scheduling.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 trace_unchanged_line has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def trace_unchanged_line(position)
          a_path = position.old_path
          a_line = position.old_line
          b_path = position.new_path
          b_line = position.new_line
Severity: Minor
Found in lib/gitlab/diff/position_tracer/line_strategy.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 loop_until has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def loop_until(timeout: nil, limit: 1_000_000)
      raise ArgumentError unless limit

      start = Time.now

Severity: Minor
Found in lib/gitlab/loop_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 link_dependencies has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def link_dependencies
        highlighted_lines.map!.with_index do |rich_line, i|
          plain_line = plain_lines[i].chomp
          match = REGEX.match(plain_line)
          next rich_line unless match
Severity: Minor
Found in lib/gitlab/dependency_linker/go_mod_linker.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 oauth_access_token_check has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def oauth_access_token_check(login, password)
        if login == "oauth2" && password.present?
          token = Doorkeeper::AccessToken.by_token(password)

          if valid_oauth_token?(token)
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 check_authentication_abilities! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def check_authentication_abilities!
      case cmd
      when *DOWNLOAD_COMMANDS
        unless authentication_abilities.include?(:download_code) || authentication_abilities.include?(:build_download_code)
          raise ForbiddenError, error_message(:auth_download)
Severity: Minor
Found in lib/gitlab/git_access.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 list_key_ids has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def list_key_ids
      logger.info('Listing all key IDs')

      [].tap do |a|
        open_authorized_keys_file('r') do |f|
Severity: Minor
Found in lib/gitlab/authorized_keys.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 merge_to_ref has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def merge_to_ref(user, source_sha, branch, target_ref, message, first_parent_ref)
Severity: Minor
Found in lib/gitlab/git/repository.rb - About 45 mins to fix

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

          def lazy_page_iterator(starting_page: 1, page_limit: nil, per_page: PER_PAGE)
            Enumerator.new do |y|
              page = starting_page
              page_limit = (starting_page - 1) + page_limit if page_limit
    
    
    Severity: Minor
    Found in lib/gitlab/gitlab_import/client.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 issues has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def issues
          if project&.external_references_supported?
            if project.issues_enabled?
              @references[:all_issues] ||= references(:external_issue) + references(:issue)
            else
    Severity: Minor
    Found in lib/gitlab/reference_extractor.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 update_remote_mirror has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def update_remote_mirror(ref_name, only_branches_matching, ssh_key: nil, known_hosts: nil, keep_divergent_refs: false)
            req_enum = Enumerator.new do |y|
              first_request = Gitaly::UpdateRemoteMirrorRequest.new(
                repository: @gitaly_repo,
                ref_name: ref_name
    Severity: Minor
    Found in lib/gitlab/gitaly_client/remote_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 user_merge_to_ref has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def user_merge_to_ref(user, source_sha, branch, target_ref, message, first_parent_ref)
    Severity: Minor
    Found in lib/gitlab/gitaly_client/operation_service.rb - About 45 mins to fix

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

            def find_file(name, revision)
              request = Gitaly::WikiFindFileRequest.new(
                repository: @gitaly_repo,
                name: encode_binary(name),
                revision: encode_binary(revision)
      Severity: Minor
      Found in lib/gitlab/gitaly_client/wiki_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

      Severity
      Category
      Status
      Source
      Language