gitlabhq/gitlabhq

View on GitHub

Showing 1,220 of 1,662 total issues

Method note_project has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def note_project
    strong_memoize(:note_project) do
      next nil unless project

      note_project_id = params[:note_project_id]
Severity: Minor
Found in app/controllers/concerns/notes_actions.rb - About 1 hr 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 execute has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def execute
    return unless executable?

    ActiveRecord::Base.transaction do
      environment.external_url = expanded_environment_url if
Severity: Minor
Found in app/services/create_deployment_service.rb - About 1 hr 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 logs_tree has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def logs_tree
    @offset = if params[:offset].present?
                params[:offset].to_i
              else
                0
Severity: Minor
Found in app/controllers/projects/refs_controller.rb - About 1 hr 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 show has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def show
    validates_merge_request
    close_merge_request_without_source_project
    check_if_can_be_merged

Severity: Minor
Found in app/controllers/projects/merge_requests_controller.rb - About 1 hr 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 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    namespace = Namespace.find(params[:namespace_key])

    @forked_project = namespace.projects.find_by(path: project.path)
    @forked_project = nil unless @forked_project && @forked_project.forked_from_project == project
Severity: Minor
Found in app/controllers/projects/forks_controller.rb - About 1 hr 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 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def update(issuable)
    change_state(issuable)
    change_subscription(issuable)
    change_todo(issuable)
    toggle_award(issuable)
Severity: Minor
Found in app/services/issuable_base_service.rb - About 1 hr 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 link_to_member has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def link_to_member(project, author, opts = {}, &block)
    default_opts = { avatar: true, name: true, title: ":name" }
    opts = default_opts.merge(opts)

    return "(deleted)" unless author
Severity: Minor
Found in app/helpers/projects_helper.rb - About 1 hr 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_changes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def handle_changes(merge_request, options)
      old_associations = options.fetch(:old_associations, {})
      old_labels = old_associations.fetch(:labels, [])
      old_mentioned_users = old_associations.fetch(:mentioned_users, [])

Severity: Minor
Found in app/services/merge_requests/update_service.rb - About 1 hr 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 on_send has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

        def on_send(node)
          return unless in_migration?(node)

          name = node.children[1]

Severity: Minor
Found in rubocop/cop/migration/add_column.rb - About 1 hr 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 on_send has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def on_send(node)
        return unless method_name(node).to_s =~ METHOD_NAME_PATTERN

        namespace_expr, project_expr = arguments(node)
        return unless namespace_expr && project_expr
Severity: Minor
Found in rubocop/cop/project_path_helper.rb - About 1 hr 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 commitTooltip has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

Raphael.prototype.commitTooltip = function commitTooltip(x, y, commit) {
  const boxWidth = 300;
  const icon = this.image(gon.relative_url_root + commit.author.icon, x, y, 20, 20);
  const nameText = this.text(x + 25, y + 10, commit.author.name);
  const idText = this.text(x, y + 35, commit.id);
Severity: Minor
Found in app/assets/javascripts/network/raphael.js - About 1 hr to fix

    Function GitLabDropdownInput has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function GitLabDropdownInput(input, options) {
        var $inputContainer, $clearButton;
        var _this = this;
        this.input = input;
        this.options = options;
    Severity: Minor
    Found in app/assets/javascripts/gl_dropdown.js - About 1 hr to fix

      Function setConfig has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        setConfig() {
          const config = {
            InputSetter: [{
              input: this.noteTypeInput,
              valueAttribute: 'data-value',
      Severity: Minor
      Found in app/assets/javascripts/comment_type_toggle.js - About 1 hr to fix

        Function onSearchInputKeyUp has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          onSearchInputKeyUp(e) {
            switch (e.keyCode) {
              case KEYCODE.BACKSPACE:
                // when trying to remove the location badge
                if (this.lastTextLength === 0 && this.badgePresent()) {
        Severity: Minor
        Found in app/assets/javascripts/search_autocomplete.js - About 1 hr to fix

          Function renderRow has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  renderRow: function(user) {
                    var avatar, img, listClosingTags, listWithName, listWithUserName, username;
                    username = user.username ? "@" + user.username : "";
                    avatar = user.avatar_url ? user.avatar_url : gon.default_avatar_url;
          
          
          Severity: Minor
          Found in app/assets/javascripts/users_select.js - About 1 hr to fix

            Function formatGroupItem has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              formatGroupItem(rawGroupItem) {
                const groupChildren = rawGroupItem.children || [];
                const groupIsOpen = (groupChildren.length > 0) || false;
                const childrenCount = this.hideProjects ?
                  rawGroupItem.subgroup_count :
            Severity: Minor
            Found in app/assets/javascripts/groups/store/groups_store.js - About 1 hr to fix

              Method calculate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def calculate
                      cte = recursive_cte
                      cte_alias = cte.table.alias(Group.table_name)
                      projects = Project.arel_table
                      links = ProjectGroupLink.arel_table
              Severity: Minor
              Found in lib/gitlab/project_authorizations/with_nested_groups.rb - About 1 hr to fix

                Method add_concurrent_foreign_key has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def add_concurrent_foreign_key(source, target, column:, on_delete: :cascade)
                        # Transactions would result in ALTER TABLE locks being held for the
                        # duration of the transaction, defeating the purpose of this method.
                        if transaction_open?
                          raise 'add_concurrent_foreign_key can not be run inside a transaction'
                Severity: Minor
                Found in lib/gitlab/database/migration_helpers.rb - About 1 hr to fix

                  Method import_pull_requests has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def import_pull_requests
                          pull_requests = client.pull_requests(repo)
                  
                          pull_requests.each do |pull_request|
                            begin
                  Severity: Minor
                  Found in lib/gitlab/bitbucket_import/importer.rb - About 1 hr to fix

                    Function buildGraph has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      BranchGraph.prototype.buildGraph = function() {
                        var cuday, cumonth, day, j, len, mm, r, ref;
                        r = this.r;
                        cuday = 0;
                        cumonth = "";
                    Severity: Minor
                    Found in app/assets/javascripts/network/branch_graph.js - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language