gitlabhq/gitlabhq

View on GitHub

Showing 1,757 of 2,500 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

Avoid too many return statements within this function.
Open

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

    Avoid too many return statements within this function.
    Open

      return metricStates.UNKNOWN_ERROR;
    Severity: Major
    Found in app/assets/javascripts/monitoring/stores/mutations.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 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 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.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 axios
                              .put(issueUpdateURL, data)
                              .then(({ data }) => {
                                $dropdown.trigger('loaded.gl.dropdown');
                                // eslint-disable-next-line no-jquery/no-fade
                Severity: Major
                Found in app/assets/javascripts/milestone_select.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 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.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 stateKey.workInProgress;
                        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.unresolvedDiscussions;
                          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

                              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.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 null;
                                  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

                                      Avoid too many return statements within this function.
                                      Open

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