gitlabhq/gitlabhq

View on GitHub

Showing 1,679 of 2,388 total issues

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

        def self.login(login, password)
          return unless Gitlab::Auth::LDAP::Config.enabled?
          return unless login.present? && password.present?

          # return found user that was authenticated by first provider for given login credentials
Severity: Minor
Found in lib/gitlab/auth/ldap/authentication.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 parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.parse(repo_path)
      project_path = repo_path.sub(/\.git\z/, '').sub(%r{\A/}, '')

      # Detect the repo type based on the path, the first one tried is the project
      # type, which does not have a suffix.
Severity: Minor
Found in lib/gitlab/repo_path.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 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 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 decorate_params_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def decorate_params_value(path_hash, value_hash)
          unless path_hash.is_a?(Hash) && path_hash.count == 1
            raise "invalid path: #{path_hash.inspect}"
          end

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

        def diff_stats_collection
          strong_memoize(:diff_stats) do
            # There are scenarios where we don't need to request Diff Stats,
            # when caching for instance.
            next unless @include_stats
Severity: Minor
Found in lib/gitlab/diff/file_collection/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 current_user has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def current_user(request, project)
        return unless has_basic_credentials?(request)

        login, password = user_name_and_password(request)
        auth_result = Gitlab::Auth.find_for_git_client(login, password, project: project, ip: request.ip)
Severity: Minor
Found in lib/gitlab/middleware/go.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 convert_to_time has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def self.convert_to_time(time_value)
      return time_value if time_value.is_a?(Time)
      return Time.iso8601(time_value) if time_value.is_a?(String)
      return Time.at(time_value) if time_value.is_a?(Numeric) && time_value > 0
    rescue ArgumentError
Severity: Minor
Found in lib/gitlab/instrumentation_helper.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 fabricate! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def self.fabricate!(pattern, fallback: false)
        raise RegexpError, 'Pattern is not string!' unless pattern.is_a?(String)

        matches = pattern.match(PATTERN)
        raise RegexpError, 'Invalid regular expression!' if matches.nil?
Severity: Minor
Found in lib/gitlab/untrusted_regexp/ruby_syntax.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 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 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 check_authentication_abilities! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_authentication_abilities!(cmd)
            case cmd
            when *DOWNLOAD_COMMANDS
              unless authentication_abilities.include?(:download_code) || authentication_abilities.include?(:build_download_code)
                raise UnauthorizedError, ERROR_MESSAGES[: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 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

      Severity
      Category
      Status
      Source
      Language