gitlabhq/gitlabhq

View on GitHub

Showing 2,020 of 2,950 total issues

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

const requestLogsUntilData = ({ commit, state }) => {
  const params = {};
  const type = state.environments.current
    ? logExplorerOptions.environments
    : logExplorerOptions.managedApps;
Severity: Minor
Found in app/assets/javascripts/logs/stores/actions.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 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 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 moveListIssues has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  moveListIssues(list, issue, oldIndex, newIndex, moveBeforeId, moveAfterId) {
Severity: Minor
Found in app/assets/javascripts/boards/stores/boards_store.js - About 45 mins to fix

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

          def resolve(**args)
            # The project could have been loaded in batch by `BatchLoader`.
            # At this point we need the `id` of the project to query for issues, so
            # make sure it's loaded and not `nil` before continuing.
            parent = object.respond_to?(:sync) ? object.sync : object
      Severity: Minor
      Found in app/graphql/resolvers/issues_resolver.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_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 that are failed or not updated in the last #{days} days..."
      
          threshold = 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

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

              def on_block(node)
                block_body = node.body
      
                return unless in_migration?(node)
                return unless block_body
      Severity: Minor
      Found in rubocop/cop/migration/with_lock_retries_disallowed_method.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

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

              def allowed_to_uninstall?
                strong_memoize(:allowed_to_uninstall) do
                  applications = nil
        
                  Clusters::Cluster::APPLICATIONS.each do |application_name, klass|
        Severity: Minor
        Found in app/models/clusters/applications/helm.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 ready? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def ready?(project_id: nil, project_path: nil, **args)
              return early_return unless can_read_profile?
        
              if project_id || project_path
                load_project(project_path, project_id)
        Severity: Minor
        Found in app/graphql/resolvers/user_merge_requests_resolver.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 sort_params has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def sort_params
            order_by = ALLOWED_SORT_VALUES.include?(params[:order_by]) ? params[:order_by] : DEFAULT_SORT_VALUE
            order_direction = ALLOWED_SORT_DIRECTIONS.include?(params[:sort]) ? params[:sort] : DEFAULT_SORT_DIRECTION
        
            { order_by => order_direction }.tap do |sort_values|
        Severity: Minor
        Found in app/finders/deployments_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

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

            def check_gitaly_config!
              LOGGER.debug "Checking gitaly-ruby Gemfile...\n"
          
              unless File.exist?(gemfile)
                message = "#{gemfile} does not exist."
          Severity: Minor
          Found in scripts/gitaly_test.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)
          
                    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 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 text_limit_missing? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def text_limit_missing?(node, table_name, attribute_name)
                    limit_found = false
          
                    node.each_descendant(:send) do |send_node|
                      next unless add_text_limit?(send_node)
          Severity: Minor
          Found in rubocop/cop/migration/add_limit_to_text_columns.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 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

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

            def initialize(range_string, project)
              @project = project
          
              range_string = range_string.strip
          
          
          Severity: Minor
          Found in app/models/commit_range.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