gitlabhq/gitlabhq

View on GitHub

Showing 1,623 of 2,301 total issues

Avoid deeply nested control flow statements.
Open

              if (file.sections[j].conflict) {
                numberConflicts += 1;
              }
Severity: Major
Found in app/assets/javascripts/merge_conflicts/merge_conflict_store.js - About 45 mins to fix

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

        buttonText() {
          if (this.isDiscussionResolved) {
            if (this.textareaIsEmpty) {
              return __('Unresolve thread');
            } else {
    Severity: Minor
    Found in app/assets/javascripts/diff_notes/components/comment_resolve_btn.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 safe_url has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        def safe_url
          return if url.nil?
      
          result = URI.parse(url)
          result.password = '*****' if result.password
      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 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

      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

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

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

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

          checkForEnter(e) {
            if (e.keyCode === 38 || e.keyCode === 40) {
              const { selectionStart } = this.filteredSearchInput;
        
              e.preventDefault();
        Severity: Minor
        Found in app/assets/javascripts/filtered_search/filtered_search_manager.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 perform_helm_releases_cleanup! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def perform_helm_releases_cleanup!(days:)
            puts "Checking for Helm releases not updated in the last #{days} days..."
        
            threshold_day = threshold_time(days: days)
        
        
        Severity: Minor
        Found in scripts/review_apps/automated_cleanup.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

        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

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

        export default function setupVueRepositoryList() {
          const el = document.getElementById('js-tree-list');
          const { dataset } = el;
          const { projectPath, projectShortPath, ref, fullName } = dataset;
          const router = createRouter(projectPath, ref);
        Severity: Minor
        Found in app/assets/javascripts/repository/index.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

                  if (usernameParams[id]) {
                    hasFilteredSearch = true;
                    const tokenName = 'author';
                    const canEdit = this.canEdit && this.canEdit(tokenName);
                    FilteredSearchVisualTokens.addFilterVisualToken(tokenName, `@${usernameParams[id]}`, {
        Severity: Major
        Found in app/assets/javascripts/filtered_search/filtered_search_manager.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

          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

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

            def cache_merge_request_closes_issues!(current_user = self.author)
              return unless project.issues_enabled?
              return if closed? || merged?
          
              transaction do
          Severity: Minor
          Found in app/models/merge_request.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 max_member_access_for_resource_ids has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def max_member_access_for_resource_ids(resource_klass, resource_ids, memoization_index = self.id, &block)
                raise 'Block is mandatory' unless block_given?
          
                resource_ids = resource_ids.uniq
                key = max_member_access_for_resource_key(resource_klass, memoization_index)
          Severity: Minor
          Found in app/models/concerns/bulk_member_access_load.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 outbound_local_requests_whitelist_arrays has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def outbound_local_requests_whitelist_arrays
              strong_memoize(:outbound_local_requests_whitelist_arrays) do
                next [[], []] unless self.outbound_local_requests_whitelist
          
                ip_whitelist = []
          Severity: Minor
          Found in app/models/application_setting_implementation.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 readme_path has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def readme_path
              strong_memoize(:readme_path) do
                available_readmes = blobs.select do |blob|
                  Gitlab::FileDetector.type_of(blob.name) == :readme
                end
          Severity: Minor
          Found in app/models/tree.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 uri_type has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def uri_type(path)
              entry = @raw.tree_entry(path)
              return unless entry
          
              if entry[:type] == :blob
          Severity: Minor
          Found in app/models/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

          Severity
          Category
          Status
          Source
          Language