gitlabhq/gitlabhq

View on GitHub

Showing 1,362 of 1,915 total issues

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

        def readline
          out = []

          until eof?
            data = chunk_slice_from_offset
Severity: Minor
Found in lib/gitlab/ci/trace/chunked_io.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 create_cluster_role_binding has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def create_cluster_role_binding(command)
          command.cluster_role_binding_resource.tap do |cluster_role_binding_resource|
            break unless cluster_role_binding_resource

            if cluster_role_binding_exists?(cluster_role_binding_resource)
Severity: Minor
Found in lib/gitlab/kubernetes/helm/api.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 format_attachments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def format_attachments(issue_id, comment_id, raw_attachments)
        return [] unless raw_attachments

        raw_attachments.map do |attachment|
          next if attachment["isDeleted"]
Severity: Minor
Found in lib/gitlab/google_code_import/importer.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(*%w(gzip -1 -c), 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

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

              def variables_expressions_syntax
                return unless variables.is_a?(Array)

                statements = variables.map do |statement|
                  ::Gitlab::Ci::Pipeline::Expression::Statement.new(statement)
Severity: Minor
Found in lib/gitlab/ci/config/entry/policy.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 note_url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def note_url
      if object.for_commit?
        commit_url(id: object.commit_id, anchor: dom_id(object))

      elsif object.for_issue?
Severity: Minor
Found in lib/gitlab/url_builder.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

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 false;
    Severity: Major
    Found in app/assets/javascripts/behaviors/shortcuts/shortcuts_issuable.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.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.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 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.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 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 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.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