gitlabhq/gitlabhq

View on GitHub

Showing 1,499 of 2,147 total issues

Method parse has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

      def parse(lines, diff_file: nil)
        return [] if lines.blank?

        @lines = lines
        line_obj_index = 0
Severity: Minor
Found in lib/gitlab/diff/parser.rb - About 4 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

Function Keyboard has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Keyboard = function() {
  var currentKey;
  var currentFocus;
  var isUpArrow = false;
  var isDownArrow = false;
Severity: Major
Found in app/assets/javascripts/droplab/keyboard.js - About 4 hrs to fix

    `` has 33 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default {
      [types.SET_BASE_CONFIG](state, options) {
        const { endpoint, projectPath, dismissEndpoint, showSuggestPopover } = options;
        Object.assign(state, { endpoint, projectPath, dismissEndpoint, showSuggestPopover });
      },
    Severity: Minor
    Found in app/assets/javascripts/diffs/store/mutations.js - About 4 hrs to fix

      Class Repository has 33 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class Repository
            include Scenario::Actable
            RepositoryCommandError = Class.new(StandardError)
      
            attr_writer :use_lfs
      Severity: Minor
      Found in qa/qa/git/repository.rb - About 4 hrs to fix

        Class CommitService has 33 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class CommitService
              include Gitlab::EncodingHelper
        
              def initialize(repository)
                @gitaly_repo = repository.gitaly_repository
        Severity: Minor
        Found in lib/gitlab/gitaly_client/commit_service.rb - About 4 hrs to fix

          Class EeCompatCheck has 33 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class EeCompatCheck
              CANONICAL_CE_PROJECT_URL = 'https://gitlab.com/gitlab-org/gitlab-ce'.freeze
              CANONICAL_EE_REPO_URL = 'https://gitlab.com/gitlab-org/gitlab-ee.git'.freeze
              CHECK_DIR = Rails.root.join('ee_compat_check')
              IGNORED_FILES_REGEX = /VERSION|CHANGELOG\.md/i.freeze
          Severity: Minor
          Found in lib/gitlab/ee_compat_check.rb - About 4 hrs to fix

            Function jumpToNextUnresolvedDiscussion has 103 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                jumpToNextUnresolvedDiscussion: function() {
                  let discussionsSelector;
                  let discussionIdsInScope;
                  let firstUnresolvedDiscussionId;
                  let nextUnresolvedDiscussionId;
            Severity: Major
            Found in app/assets/javascripts/diff_notes/components/jump_to_discussion.js - About 4 hrs to fix

              File stat_graph_contributors_graph.js has 337 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /* eslint-disable func-names, no-restricted-syntax, no-use-before-define, no-param-reassign, new-cap, no-underscore-dangle, no-return-assign, prefer-arrow-callback, prefer-template, no-else-return, no-shadow */
              
              import $ from 'jquery';
              import _ from 'underscore';
              import { extent, max } from 'd3-array';

                Method dropdown_tag has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                  def dropdown_tag(toggle_text, options: {}, &block)
                    content_tag :div, class: "dropdown #{options[:wrapper_class] if options.key?(:wrapper_class)}" do
                      data_attr = { toggle: "dropdown" }
                
                      if options.key?(:data)
                Severity: Minor
                Found in app/helpers/dropdowns_helper.rb - About 4 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

                Method call has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                      def call
                        return doc unless project || group
                
                        ref_pattern = object_class.reference_pattern
                        link_pattern = object_class.link_reference_pattern
                Severity: Minor
                Found in lib/banzai/filter/abstract_reference_filter.rb - About 4 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

                CreateMergeRequestDropdown has 32 functions (exceeds 20 allowed). Consider refactoring.
                Open

                export default class CreateMergeRequestDropdown {
                  constructor(wrapperEl) {
                    this.wrapperEl = wrapperEl;
                    this.availableButton = this.wrapperEl.querySelector('.available');
                    this.branchInput = this.wrapperEl.querySelector('.js-branch-name');
                Severity: Minor
                Found in app/assets/javascripts/create_merge_request_dropdown.js - About 4 hrs to fix

                  FilteredSearchManager has 32 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  export default class FilteredSearchManager {
                    constructor({
                      page,
                      isGroup = false,
                      isGroupAncestor = true,
                  Severity: Minor
                  Found in app/assets/javascripts/filtered_search/filtered_search_manager.js - About 4 hrs to fix

                    Class PagesDomain has 32 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class PagesDomain < ApplicationRecord
                      VERIFICATION_KEY = 'gitlab-pages-verification-code'.freeze
                      VERIFICATION_THRESHOLD = 3.days.freeze
                      SSL_RENEWAL_THRESHOLD = 30.days.freeze
                    
                    
                    Severity: Minor
                    Found in app/models/pages_domain.rb - About 4 hrs to fix

                      Class Base has 32 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          class Base
                            prepend Support::Page::Logging if Runtime::Env.debug?
                            include Capybara::DSL
                            include Scenario::Actable
                            extend Validatable
                      Severity: Minor
                      Found in qa/qa/page/base.rb - About 4 hrs to fix

                        Class User has 32 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                              class User
                                SignupDisabledError = Class.new(StandardError)
                                SigninDisabledForProviderError = Class.new(StandardError)
                        
                                attr_accessor :auth_hash, :gl_user
                        Severity: Minor
                        Found in lib/gitlab/auth/o_auth/user.rb - About 4 hrs to fix

                          Class RefService has 32 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                              class RefService
                                include Gitlab::EncodingHelper
                          
                                # 'repository' is a Gitlab::Git::Repository
                                def initialize(repository)
                          Severity: Minor
                          Found in lib/gitlab/gitaly_client/ref_service.rb - About 4 hrs to fix

                            File merge_request_tabs.js has 333 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            /* eslint-disable no-new, class-methods-use-this */
                            
                            import $ from 'jquery';
                            import Vue from 'vue';
                            import Cookies from 'js-cookie';
                            Severity: Minor
                            Found in app/assets/javascripts/merge_request_tabs.js - About 4 hrs to fix

                              File group.rb has 328 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              require 'carrierwave/orm/activerecord'
                              
                              class Group < Namespace
                                include Gitlab::ConfigHelper
                                include AfterCommitQueue
                              Severity: Minor
                              Found in app/models/group.rb - About 3 hrs to fix

                                Api has 31 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                const Api = {
                                  groupsPath: '/api/:version/groups.json',
                                  groupPath: '/api/:version/groups/:id',
                                  groupMembersPath: '/api/:version/groups/:id/members',
                                  subgroupsPath: '/api/:version/groups/:id/subgroups',
                                Severity: Minor
                                Found in app/assets/javascripts/api.js - About 3 hrs to fix

                                  Class Runner has 31 methods (exceeds 20 allowed). Consider refactoring.
                                  Open

                                    class Runner < ApplicationRecord
                                      extend Gitlab::Ci::Model
                                      include Gitlab::SQL::Pattern
                                      include IgnorableColumn
                                      include RedisCacheable
                                  Severity: Minor
                                  Found in app/models/ci/runner.rb - About 3 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language