gitlabhq/gitlabhq

View on GitHub

Showing 1,757 of 2,500 total issues

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

      def do_run
        raise ArgumentError, "Please provide GITLAB_USERNAME" unless ENV['GITLAB_USERNAME']
        raise ArgumentError, "Please provide GITLAB_PASSWORD" unless ENV['GITLAB_PASSWORD']
        raise ArgumentError, "Please provide GITLAB_ADDRESS" unless ENV['GITLAB_ADDRESS']

Severity: Minor
Found in qa/qa/tools/revoke_all_personal_access_tokens.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 process_link_to_upload_attr has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def process_link_to_upload_attr(html_attr)
        return unless html_attr.value.start_with?('/uploads/')

        path_parts = [unescape_and_scrub_uri(html_attr.value)]

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

        def remove_non_footnote_ids
          lambda do |env|
            node = env[:node]

            return unless (pattern = FOOTNOTE_LINK_ID_PATTERNS[node.name.to_sym])
Severity: Minor
Found in lib/banzai/filter/ascii_doc_sanitization_filter.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 embeds_by_node has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def embeds_by_node
        strong_memoize(:embeds_by_node) do
          nodes.each_with_object({}) do |node, embeds|
            embed = Embed.new
            url = node.attribute('data-dashboard-url').to_s
Severity: Minor
Found in lib/banzai/filter/inline_metrics_redactor_filter.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 dedup_tree has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def dedup_tree(node, nodes_seen = {})
          if nodes_seen.key?(node) && distinguishable?(node)
            yield nodes_seen[node]
          elsif should_dedup?(node)
            nodes_seen[node] = node
Severity: Minor
Found in lib/gitlab/import_export/project/tree_loader.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 pod_logs has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def pod_logs(namespace, pod_name, container_name = nil, search = nil, start_time = nil, end_time = nil)
Severity: Minor
Found in lib/gitlab/elasticsearch/logs.rb - About 45 mins to fix

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

          def call
            return doc if context[:autolink] == false
    
            doc.xpath(TEXT_QUERY).each do |node|
              content = node.to_html
    Severity: Minor
    Found in lib/banzai/filter/autolink_filter.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 expand_attributes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def expand_attributes(klass, attributes)
            expanded = attributes.flat_map do |attribute|
              attr_config = klass.encrypted_attributes[attribute]
              crypt_column_name = attr_config&.fetch(:attribute)
    
    
    Severity: Minor
    Found in lib/gitlab/background_migration/encrypt_columns.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 verified_signature? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def verified_signature?
            # verify has multiple options but only a boolean return value
            # so first verify without certificate chain
            if valid_signature?
              if valid_signing_time?
    Severity: Minor
    Found in lib/gitlab/x509/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 remove_non_heading_ids has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def remove_non_heading_ids
              lambda do |env|
                node = env[:node]
    
                return unless SECTION_HEADINGS.any?(node.name)
    Severity: Minor
    Found in lib/banzai/filter/ascii_doc_sanitization_filter.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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def initialize(path, filename: nil, content_type: "application/octet-stream", sha256: nil, remote_id: nil, size: nil)
        if path.present?
          raise InvalidPathError, "#{path} file does not exist" unless ::File.exist?(path)
    
          @tempfile = File.new(path, 'rb')
    Severity: Minor
    Found in lib/uploaded_file.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 ensure_hash has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def ensure_hash(ambiguous_param)
            case ambiguous_param
            when String
              if ambiguous_param.present?
                ensure_hash(JSON.parse(ambiguous_param))
    Severity: Minor
    Found in lib/gitlab/graphql/variables.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 perform has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            def perform(resource_model, join, conditions, with_notes, start_id, end_id)

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

            def data_to_insert(query)
              data = { 'jira_tracker_data' => [], 'issue_tracker_data' => [] }
              select_all(query).each do |service|
                begin
                  properties = JSON.parse(service['properties'])
      Severity: Minor
      Found in lib/gitlab/background_migration/migrate_issue_trackers_sensitive_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 load_uri_types has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def load_uri_types
              return unless linkable_attributes.present?
              return unless linkable_files?
              return {} unless repository
      
      
      Severity: Minor
      Found in lib/banzai/filter/repository_link_filter.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

      Severity
      Category
      Status
      Source
      Language