gitlabhq/gitlabhq

View on GitHub

Showing 1,499 of 2,147 total issues

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

          def attributes(*attributes)
            attributes.flatten.each do |attribute|
              if method_defined?(attribute)
                raise ArgumentError, 'Method already defined!'
              end
Severity: Minor
Found in lib/gitlab/config/entry/attributable.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 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 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 validate_job_dependencies! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def validate_job_dependencies!(name, job)
            return unless job[:dependencies]
    
            stage_index = @stages.index(job[:stage])
    
    
    Severity: Minor
    Found in lib/gitlab/ci/yaml_processor.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 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 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 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

      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

      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 moveIssue has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                moveIssue(id, fromListId = null, toListId = null, moveBeforeId = null, moveAfterId = null) {
              Severity: Minor
              Found in app/assets/javascripts/boards/stores/boards_store.js - About 35 mins to fix

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

                  moveIssueInList(list, issue, oldIndex, newIndex, idArray) {
                Severity: Minor
                Found in app/assets/javascripts/boards/stores/boards_store.js - About 35 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language