gitlabhq/gitlabhq

View on GitHub

Showing 1,391 of 2,006 total issues

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

      def authenticate_delete_runner!(runner)
        return if current_user.admin?

        forbidden!("Runner associated with more than one project") if runner.projects.count > 1
        forbidden!("No access granted") unless can?(current_user, :delete_runner, runner)
Severity: Minor
Found in lib/api/runners.rb - About 35 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_groups has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def find_groups(params, parent_id = nil)
        find_params = params.slice(:all_available, :custom_attributes, :owned, :min_access_level)
        find_params[:parent] = find_group!(parent_id) if parent_id
        find_params[:all_available] =
          find_params.fetch(:all_available, current_user&.full_private_access?)
Severity: Minor
Found in lib/api/groups.rb - About 35 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 cleanup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def cleanup
      progress.print "Deleting tmp directories ... "

      backup_contents.each do |dir|
        next unless File.exist?(File.join(backup_path, dir))
Severity: Minor
Found in lib/backup/manager.rb - About 35 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 update_label has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def update_label(parent, entity)
        authorize! :admin_label, parent

        label = find_label(parent, params[:name], include_ancestor_groups: false)
        update_priority = params.key?(:priority)
Severity: Minor
Found in lib/api/helpers/label_helpers.rb - About 35 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 filter_builds has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def filter_builds(builds, scope)
        return builds if scope.nil? || scope.empty?

        available_statuses = ::CommitStatus::AVAILABLE_STATUSES

Severity: Minor
Found in lib/api/jobs.rb - About 35 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 dump has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def dump
      FileUtils.mkdir_p(File.dirname(db_file_name))
      FileUtils.rm_f(db_file_name)
      compress_rd, compress_wr = IO.pipe
      compress_pid = spawn(gzip_cmd, in: compress_rd, out: [db_file_name, 'w', 0600])
Severity: Minor
Found in lib/backup/database.rb - About 35 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 too many return statements within this function.
Open

  return 0;
Severity: Major
Found in app/assets/javascripts/ide/stores/utils.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                  return saveLabelData();
    Severity: Major
    Found in app/assets/javascripts/labels_select.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return $dropdown.closest('form').submit();
      Severity: Major
      Found in app/assets/javascripts/labels_select.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return stateKey.pipelineFailed;
        Severity: Major
        Found in app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return stateKey.rebase;
          Severity: Major
          Found in app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return stateKey.pipelineBlocked;
            Severity: Major
            Found in app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return stateKey.conflicts;
              Severity: Major
              Found in app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return true;
                Severity: Major
                Found in app/assets/javascripts/create_merge_request_dropdown.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                            return this.removeNoteEditForm(editNote);
                  Severity: Major
                  Found in app/assets/javascripts/notes.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                        return stateKey.notAllowedToMerge;
                    Severity: Major
                    Found in app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return stateKey.shaMismatch;
                      Severity: Major
                      Found in app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return this.mergeError ? stateKey.autoMergeFailed : stateKey.mergeWhenPipelineSucceeds;
                        Severity: Major
                        Found in app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return stateKey.readyToMerge;
                          Severity: Major
                          Found in app/assets/javascripts/vue_merge_request_widget/stores/get_state_key.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                          return;
                            Severity: Major
                            Found in app/assets/javascripts/notes.js - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language