gitlabhq/gitlabhq

View on GitHub

Showing 1,551 of 2,202 total issues

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

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

                    def perform!
                      unless @pipeline.config_processor
                        unless @pipeline.ci_yaml_file
                          return error("Missing #{@pipeline.ci_yaml_file_path} file")
                        end
        Severity: Minor
        Found in lib/gitlab/ci/pipeline/chain/validate/config.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 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 perform_substitutions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def perform_substitutions(content, commands)
                return unless content
        
                substitution_definitions = self.command_definitions.select do |definition|
                  definition.is_a?(Gitlab::QuickActions::SubstitutionDefinition)
        Severity: Minor
        Found in lib/gitlab/quick_actions/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 add_to_whitelist has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

                  def add_to_whitelist
                    return success unless prometheus_enabled?
                    return success unless prometheus_listen_address.present?
        
                    uri = parse_url(internal_prometheus_listen_address_uri)
        Severity: Minor
        Found in lib/gitlab/database_importers/self_monitoring/project/create_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 create_label has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def create_label(parent, entity)
                authorize! :admin_label, parent
        
                label = available_labels_for(parent).find_by_title(params[:name])
                conflict!('Label already exists') if label
        Severity: Minor
        Found in lib/api/helpers/label_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 filter_runners has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def filter_runners(runners, scope, allowed_scopes: ::Ci::Runner::AVAILABLE_SCOPES)
                return runners unless scope.present?
        
                unless allowed_scopes.include?(scope)
                  render_api_error!('Scope contains invalid value', 400)
        Severity: Minor
        Found in lib/api/runners.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 compute_class_for_class has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def compute_class_for_class(subject_class)
              subject_class.ancestors.each do |klass|
                next unless klass.name
        
                begin
        Severity: Minor
        Found in lib/declarative_policy.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_releases_page has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def each_releases_page(args, &block)
              return to_enum(__method__, args) unless block_given?
        
              page = 1
              offset = ''
        Severity: Minor
        Found in lib/quality/helm_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 apply_filters has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def apply_filters(projects)
                projects = projects.with_issues_available_for_user(current_user) if params[:with_issues_enabled]
                projects = projects.with_merge_requests_enabled if params[:with_merge_requests_enabled]
                projects = projects.with_statistics if params[:statistics]
        
        
        Severity: Minor
        Found in lib/api/projects.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

        Consider simplifying this complex logical expression.
        Open

            elsif confidential?
              author == user ||
                assignees.include?(user) ||
                project.team.member?(user, Gitlab::Access::REPORTER)
            else
        Severity: Major
        Found in app/models/issue.rb - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                    if closing && opening &&
                        closing.text? && opening.text? &&
                        closing.content.first == DOLLAR_SIGN &&
                        opening.content.last == DOLLAR_SIGN
          
          
          Severity: Major
          Found in lib/banzai/filter/math_filter.rb - About 40 mins to fix

            Function projectTemplate has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              projectTemplate(id, type, key, options, callback) {
            Severity: Minor
            Found in app/assets/javascripts/api.js - About 35 mins to fix

              Function issueTemplate has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                issueTemplate(namespacePath, projectPath, key, type, callback) {
              Severity: Minor
              Found in app/assets/javascripts/api.js - About 35 mins to fix

                Function addLineReferences has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                export function addLineReferences(lines, lineNumbers, bottom, isExpandDown, nextLineNumbers) {
                Severity: Minor
                Found in app/assets/javascripts/diffs/store/utils.js - About 35 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language