gitlabhq/gitlabhq

View on GitHub

Showing 1,757 of 2,500 total issues

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

        def on_send(node)
          return unless in_migration?(node)

          name = node.children[1]

Severity: Minor
Found in rubocop/cop/migration/add_concurrent_index.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

Function handleRepositoryUrlInput has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  handleRepositoryUrlInput(forceMatch) {
    const protocol = this.$repositoryUrl.val().split('://')[0];
    const protRegEx = /http|git/;

    // Validate URL and verify if it consists only supported protocols
Severity: Minor
Found in app/assets/javascripts/mirrors/ssh_mirror.js - 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

Avoid deeply nested control flow statements.
Open

        } else if (!match && keyParam === 'search') {
          hasFilteredSearch = true;
          this.filteredSearchInput.value = sanitizedValue;
        }
Severity: Major
Found in app/assets/javascripts/filtered_search/filtered_search_manager.js - About 45 mins to fix

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

            def on_send(node)
              return unless in_migration?(node)
              return unless add_column_with_default?(node)
    
              node.each_ancestor(:def) do |def_node|
    Severity: Minor
    Found in rubocop/cop/migration/reversible_add_column_with_default.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 on_def has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def on_def(node)
              def_method = node.children[0]
    
              return unless in_migration?(node) && !in_post_deployment_migration?(node)
              return unless def_method == :change || def_method == :up
    Severity: Minor
    Found in rubocop/cop/migration/remove_column.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

    Avoid deeply nested control flow statements.
    Open

              if (usernameParams[id]) {
                hasFilteredSearch = true;
                const tokenName = 'author';
                const canEdit = this.canEdit && this.canEdit(tokenName);
                const operator = FilteredSearchVisualTokens.getOperatorToken(usernameParams[id]);
    Severity: Major
    Found in app/assets/javascripts/filtered_search/filtered_search_manager.js - About 45 mins to fix

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

        def execute
          deployments = project.deployments
          deployments =
            if ref
              deployments_query = params[:with_tags] ? 'ref = :ref OR tag IS TRUE' : 'ref = :ref'
      Severity: Minor
      Found in app/finders/environments_finder.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

      Function createFlash has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        message,
        type = FLASH_TYPES.ALERT,
        parent = document,
        actionConfig = null,
        fadeTransition = true,
      Severity: Minor
      Found in app/assets/javascripts/flash.js - About 45 mins to fix

        Function handleSelectedRange has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        const handleSelectedRange = (range, restrictToNode) => {
          // Make sure this range is within the restricting container
          if (restrictToNode && !range.intersectsNode(restrictToNode)) return null;
        
          // If only a part of the range is within the wanted container, we need to restrict the range to it
        Severity: Minor
        Found in app/assets/javascripts/lib/utils/common_utils.js - 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

        Function loadDropdown has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          loadDropdown(dropdownName = '') {
            let firstLoad = false;
        
            if (!this.droplab) {
              firstLoad = true;

        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

        Function getLastTokenPartial has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          static getLastTokenPartial(includeOperator = false) {
            const { lastVisualToken } = FilteredSearchVisualTokens.getLastVisualTokenBeforeInput();
        
            if (!lastVisualToken) return '';
        
        
        Severity: Minor
        Found in app/assets/javascripts/filtered_search/filtered_search_visual_tokens.js - 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 by_assignee has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def by_assignee(items)
            return items.assigned_to(assignees) if not_query? && assignees.any?
        
            if filter_by_no_assignee?
              items.unassigned
        Severity: Minor
        Found in app/finders/issuable_finder.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 merge_to_ref has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def merge_to_ref(user, source_sha, merge_request, target_ref, message, first_parent_ref)
        Severity: Minor
        Found in app/models/repository.rb - About 45 mins to fix

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

            def safe_url(usernames_whitelist: [])
              return if url.nil?
          
              uri = URI.parse(url)
              uri.password = '*****' if uri.password
          Severity: Minor
          Found in app/models/concerns/safe_url.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 enabled has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def enabled
              return false unless project && super
              return false unless project.remote_mirror_available?
              return false unless project.repository_exists?
              return false if project.pending_delete?
          Severity: Minor
          Found in app/models/remote_mirror.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 visible_to_user? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def visible_to_user?(user = nil)
              return false unless project && project.feature_available?(:issues, user)
          
              return publicly_visible? unless user
          
          
          Severity: Minor
          Found in app/models/issue.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 protected_for? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def protected_for?(ref)
              raise Repository::AmbiguousRefError if repository.ambiguous_ref?(ref)
          
              resolved_ref = repository.expand_ref(ref) || ref
              return false unless Gitlab::Git.tag_ref?(resolved_ref) || Gitlab::Git.branch_ref?(resolved_ref)
          Severity: Minor
          Found in app/models/project.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 next_branch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def next_branch(name, opts = {})
              branch_ids = self.branch_names.map do |n|
                next 1 if n == name
          
                result = n.match(/\A#{name}-([0-9]+)\z/)
          Severity: Minor
          Found in app/models/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 chronic_duration_attr_writer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def chronic_duration_attr_writer(virtual_attribute, source_attribute, parameters = {})
                chronic_duration_attr_reader(virtual_attribute, source_attribute)
          
                define_method("#{virtual_attribute}=") do |value|
                  chronic_duration_attributes[virtual_attribute] = value.presence || parameters[:default].presence.to_s
          Severity: Minor
          Found in app/models/concerns/chronic_duration_attribute.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 in_reply_to? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def in_reply_to?(other)
              case other
              when Note
                if part_of_discussion?
                  in_reply_to?(other.noteable) && in_reply_to?(other.to_discussion)
          Severity: Minor
          Found in app/models/note.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