gitlabhq/gitlabhq

View on GitHub

Showing 1,605 of 2,285 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 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 format_response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def format_response(response)
              response[:text] = format(response[:text]) if response.key?(:text)
    
              if response.key?(:attachments)
                response[:attachments].each do |attachment|
    Severity: Minor
    Found in lib/gitlab/slash_commands/presenters/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 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 validate_each has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

              def validate_each(record, attribute, value)
                valid = validate_array_of_strings(value)
    
                record.errors.add(attribute, 'should be an array of strings') unless valid
    
    
    Severity: Minor
    Found in lib/gitlab/config/entry/validators.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

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

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

                  Method find_commits_by_message has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    def find_commits_by_message(query, ref = nil, path = nil, limit = 1000, offset = 0)
                  Severity: Minor
                  Found in app/models/repository.rb - About 35 mins to fix

                    Method track_greatest has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def track_greatest(subject, scope, usage, new_value, init)
                    Severity: Minor
                    Found in app/models/internal_id.rb - About 35 mins to fix

                      Method edit_fork_button_tag has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        def edit_fork_button_tag(common_classes, project, label, params, action = 'edit')
                      Severity: Minor
                      Found in app/helpers/blob_helper.rb - About 35 mins to fix

                        Method create_mention_todos has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          def create_mention_todos(parent, target, author, note = nil, skip_users = [])
                        Severity: Minor
                        Found in app/services/todo_service.rb - About 35 mins to fix

                          Method from_cache has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def self.from_cache(proxyable_class_name, proxyable_id, method, path, params)
                          Severity: Minor
                          Found in app/services/prometheus/proxy_service.rb - About 35 mins to fix

                            Method calculate_reactive_cache has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def calculate_reactive_cache(proxyable_class_name, proxyable_id, method, path, params)
                            Severity: Minor
                            Found in app/services/prometheus/proxy_service.rb - About 35 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language