gitlabhq/gitlabhq

View on GitHub

Showing 1,396 of 1,988 total issues

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

        def pagination_links(paginated_data)
          [].tap do |links|
            links << %(<#{page_href(page: paginated_data.prev_page)}>; rel="prev") if paginated_data.prev_page
            links << %(<#{page_href(page: paginated_data.next_page)}>; rel="next") if paginated_data.next_page
            links << %(<#{page_href(page: 1)}>; rel="first")
Severity: Minor
Found in lib/api/helpers/pagination.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 handle_merge_request_errors! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def handle_merge_request_errors!(errors)
          if errors[:project_access].any?
            error!(errors[:project_access], 422)
          elsif errors[:branch_conflict].any?
            error!(errors[:branch_conflict], 422)
Severity: Minor
Found in lib/api/merge_requests.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;
        Severity: Major
        Found in app/assets/javascripts/notes.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');
                          $loading.fadeOut();
          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 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 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 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 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.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 $dropdown.closest('form').submit();
                      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.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 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;
                                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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language