gitlabhq/gitlabhq

View on GitHub

Showing 1,757 of 2,500 total issues

Method list_milestones_for has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def list_milestones_for(parent)
          milestones = parent.milestones.order_id_desc
          milestones = Milestone.filter_by_state(milestones, params[:state])
          milestones = filter_by_iid(milestones, params[:iids]) if params[:iids].present?
          milestones = filter_by_title(milestones, params[:title]) if params[:title]
Severity: Minor
Found in lib/api/milestone_responses.rb - About 55 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 decoded has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def decoded
        secret =
          case options.algorithm
          when *%w[RS256 RS384 RS512]
            OpenSSL::PKey::RSA.new(options.secret).public_key
Severity: Minor
Found in lib/omni_auth/strategies/jwt.rb - About 55 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 9 (exceeds 5 allowed). Consider refactoring.
Open

    def dump
      prepare

      Project.find_each(batch_size: 1000) do |project|
        progress.print " * #{display_repo_path(project)} ... "
Severity: Minor
Found in lib/backup/repository.rb - About 55 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 process_commands has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def process_commands(matched_text, redact)
        output = matched_text[0]
        command = []

        if matched_text[:cmd]
Severity: Minor
Found in lib/gitlab/quick_actions/extractor.rb - About 55 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 to_h has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def to_h(context)
        desc = description
        if desc.respond_to?(:call)
          desc = context.instance_exec(&desc) rescue ''
        end
Severity: Minor
Found in lib/gitlab/quick_actions/command_definition.rb - About 55 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 create_diff_note has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def create_diff_note(iid, file_count, line_count, head_sha, start_sha, base_sha, line_type)
Severity: Major
Found in qa/qa/tools/generate_perf_testdata.rb - About 50 mins to fix

    Method initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def initialize(project_key, repo_slug, repo, name, namespace, current_user, session_data)
    Severity: Major
    Found in lib/gitlab/bitbucket_server_import/project_creator.rb - About 50 mins to fix

      Method user_squash has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def user_squash(user, squash_id, branch, start_sha, end_sha, author, message)
      Severity: Major
      Found in lib/gitlab/gitaly_client/operation_service.rb - About 50 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if (addSelectors) {
                      selectorGroups[hashValue].selectors.push(selectorLine);
                    }
        Severity: Major
        Found in scripts/frontend/stylelint/stylelint-utils.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      if ($dropdown.hasClass('js-multiselect')) {
                      } else {
                        return saveLabelData();
                      }
          Severity: Major
          Found in app/assets/javascripts/labels_select.js - About 45 mins to fix

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

              [types.SET_FILE_RAW_DATA](state, { file, raw, fileDeletedAndReadded = false }) {
                const openPendingFile = state.openFiles.find(
                  f =>
                    f.path === file.path && f.pending && !(f.tempFile && !f.prevPath && !fileDeletedAndReadded),
                );
            Severity: Minor
            Found in app/assets/javascripts/ide/stores/mutations/file.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 flattenTree has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            export const flattenTree = tree => {
              const flatten = blobTree =>
                blobTree.reduce((acc, file) => {
                  const blob = file;
                  let treeToFlatten = blob.tree;
            Severity: Minor
            Found in app/assets/javascripts/diffs/store/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 replyWithSelectedText has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              static replyWithSelectedText() {
                const $replyField = $('.js-main-target-form .js-vue-comment-form');
            
                if (!$replyField.length || $replyField.is(':hidden') /* Other tab selected in MR */) {
                  return false;
            Severity: Minor
            Found in app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.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 (messages) {
                          stylelint.utils.report({
                            result,
                            ruleName,
                            message: messages.expected(selector, lastSelector),
            Severity: Major
            Found in scripts/frontend/stylelint/stylelint-utils.js - About 45 mins to fix

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

              Sidebar.prototype.toggleSidebar = function(action) {
                if (action == null) {
                  action = 'toggle';
                }
                if (action === 'toggle') {
              Severity: Minor
              Found in app/assets/javascripts/right_sidebar.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 init has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  limit = 0,
                  preload = false,
                  disable = false,
                  prepareData = $.noop,
                  callback = $.noop,
              Severity: Minor
              Found in app/assets/javascripts/pager.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

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

                    shouldPropagate(e) {
                      let $target;
                      if (this.options.multiSelect || this.options.shouldPropagate === false) {
                        $target = $(e.target);
                        if (
                  Severity: Minor
                  Found in app/assets/javascripts/gl_dropdown.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 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

                  Severity
                  Category
                  Status
                  Source
                  Language