gitlabhq/gitlabhq

View on GitHub

Showing 1,131 of 1,537 total issues

Method each_pair has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

      def each_pair
        state = :key
        key = StringIO.new
        value = StringIO.new
        hex_buffer = ""
Severity: Minor
Found in lib/gitlab/ldap/dn.rb - About 6 hrs 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

Class NotificationService has 47 methods (exceeds 20 allowed). Consider refactoring.
Open

class NotificationService
  # Always notify user about ssh key added
  # only if ssh key is not deploy key
  #
  # This is security email so it will be sent
Severity: Minor
Found in app/services/notification_service.rb - About 6 hrs to fix

    Class Group has 45 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Group < Namespace
      include Gitlab::ConfigHelper
      include AfterCommitQueue
      include AccessRequestable
      include Avatarable
    Severity: Minor
    Found in app/models/group.rb - About 6 hrs to fix

      File migration_helpers.rb has 422 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Gitlab
        module Database
          module MigrationHelpers
            BACKGROUND_MIGRATION_BATCH_SIZE = 1000 # Number of rows to process per job
            BACKGROUND_MIGRATION_JOB_BUFFER_SIZE = 1000 # Number of jobs to bulk queue at a time
      Severity: Minor
      Found in lib/gitlab/database/migration_helpers.rb - About 6 hrs to fix

        File labels_select.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* eslint-disable no-useless-return, func-names, space-before-function-paren, wrap-iife, no-var, no-underscore-dangle, prefer-arrow-callback, max-len, one-var, no-unused-vars, one-var-declaration-per-line, prefer-template, no-new, consistent-return, object-shorthand, comma-dangle, no-shadow, no-param-reassign, brace-style, vars-on-top, quotes, no-lonely-if, no-else-return, dot-notation, no-empty, no-return-assign, camelcase, prefer-spread */
        /* global Issuable */
        /* global ListLabel */
        import _ from 'underscore';
        import { __ } from './locale';
        Severity: Minor
        Found in app/assets/javascripts/labels_select.js - About 6 hrs to fix

          Class ApplicationController has 44 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class ApplicationController < ActionController::Base
            include Gitlab::GonHelper
            include GitlabRoutingHelper
            include PageLayoutHelper
            include SentryHelper
          Severity: Minor
          Found in app/controllers/application_controller.rb - About 6 hrs to fix

            Function GitLabDropdown has 149 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function GitLabDropdown(el1, options) {
                var searchFields, selector, self;
                this.el = el1;
                this.options = options;
                this.updateLabel = this.updateLabel.bind(this);
            Severity: Major
            Found in app/assets/javascripts/gl_dropdown.js - About 5 hrs to fix

              File projects.rb has 411 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require_dependency 'declarative_policy'
              
              module API
                class Projects < Grape::API
                  include PaginationParams
              Severity: Minor
              Found in lib/api/projects.rb - About 5 hrs to fix

                Class TodoService has 43 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class TodoService
                  # When create an issue we should:
                  #
                  #  * create a todo for assignee if issue is assigned
                  #  * create a todo for each mentioned user on issue
                Severity: Minor
                Found in app/services/todo_service.rb - About 5 hrs to fix

                  File projects.rb has 406 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  module API
                    module V3
                      class Projects < Grape::API
                        include PaginationParams
                  
                  
                  Severity: Minor
                  Found in lib/api/v3/projects.rb - About 5 hrs to fix

                    File pipeline.rb has 406 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    module Ci
                      class Pipeline < ActiveRecord::Base
                        extend Gitlab::Ci::Model
                        include HasStatus
                        include Importable
                    Severity: Minor
                    Found in app/models/ci/pipeline.rb - About 5 hrs to fix

                      File application_setting.rb has 406 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      class ApplicationSetting < ActiveRecord::Base
                        include CacheMarkdownField
                        include TokenAuthenticatable
                      
                        add_authentication_token_field :runners_registration_token
                      Severity: Minor
                      Found in app/models/application_setting.rb - About 5 hrs to fix

                        File copy_as_gfm.js has 394 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /* eslint-disable class-methods-use-this, object-shorthand, no-unused-vars, no-use-before-define, no-new, max-len, no-restricted-syntax, guard-for-in, no-continue */
                        
                        import _ from 'underscore';
                        import { insertText, getSelectedFragment, nodeMatchesSelector } from '../lib/utils/common_utils';
                        import { placeholderImage } from '../lazy_loader';
                        Severity: Minor
                        Found in app/assets/javascripts/behaviors/copy_as_gfm.js - About 5 hrs to fix

                          Class Shell has 40 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                            class Shell
                              GITLAB_SHELL_ENV_VARS = %w(GIT_TERMINAL_PROMPT).freeze
                          
                              Error = Class.new(StandardError)
                          
                          
                          Severity: Minor
                          Found in lib/gitlab/shell.rb - About 5 hrs to fix

                            Method each_pair has 131 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                        def each_pair
                                          state = :key
                                          key = StringIO.new
                                          value = StringIO.new
                                          hex_buffer = ""
                            Severity: Major
                            Found in lib/gitlab/background_migration/normalize_ldap_extern_uids_range.rb - About 5 hrs to fix

                              Method each_pair has 131 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                    def each_pair
                                      state = :key
                                      key = StringIO.new
                                      value = StringIO.new
                                      hex_buffer = ""
                              Severity: Major
                              Found in lib/gitlab/ldap/dn.rb - About 5 hrs to fix

                                File search_autocomplete.js has 382 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                /* eslint-disable no-return-assign, one-var, no-var, no-underscore-dangle, one-var-declaration-per-line, no-unused-vars, no-cond-assign, consistent-return, object-shorthand, prefer-arrow-callback, func-names, space-before-function-paren, prefer-template, quotes, class-methods-use-this, no-sequences, wrap-iife, no-lonely-if, no-else-return, no-param-reassign, vars-on-top, max-len */
                                import axios from './lib/utils/axios_utils';
                                import DropdownUtils from './filtered_search/dropdown_utils';
                                import { isInGroupsPage, isInProjectPage, getGroupSlug, getProjectSlug } from './lib/utils/common_utils';
                                
                                
                                Severity: Minor
                                Found in app/assets/javascripts/search_autocomplete.js - About 5 hrs to fix

                                  Class Service has 39 methods (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  class Service < ActiveRecord::Base
                                    include Sortable
                                    include Importable
                                  
                                    serialize :properties, JSON # rubocop:disable Cop/ActiveRecordSerialize
                                  Severity: Minor
                                  Found in app/models/service.rb - About 5 hrs to fix

                                    Class Member has 39 methods (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    class Member < ActiveRecord::Base
                                      include AfterCommitQueue
                                      include Sortable
                                      include Importable
                                      include Expirable
                                    Severity: Minor
                                    Found in app/models/member.rb - About 5 hrs to fix

                                      Function postComment has 128 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        postComment(e) {
                                          e.preventDefault();
                                      
                                          // Get Form metadata
                                          const $submitBtn = $(e.target);
                                      Severity: Major
                                      Found in app/assets/javascripts/notes.js - About 5 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language