gitlabhq/gitlabhq

View on GitHub

Showing 1,533 of 2,160 total issues

File users.rb has 645 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module API
  class Users < Grape::API
    include PaginationParams
    include APIGuard
    include Helpers::CustomAttributes
Severity: Major
Found in lib/api/users.rb - About 1 day to fix

    File build.rb has 643 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module Ci
      class Build < CommitStatus
        include Ci::Processable
        include Ci::Metadatable
        include Ci::Contextable
    Severity: Major
    Found in app/models/ci/build.rb - About 1 day to fix

      Notes has 74 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export default class Notes {
        static initialize(notes_url, note_ids, last_fetched_at, view, enableGFM) {
          if (!this.instance) {
            this.instance = new Notes(notes_url, note_ids, last_fetched_at, view, enableGFM);
          }
      Severity: Major
      Found in app/assets/javascripts/notes.js - About 1 day to fix

        Class Commit has 70 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Commit
          extend ActiveModel::Naming
          extend Gitlab::Cache::RequestCache
        
          include ActiveModel::Conversion
        Severity: Major
        Found in app/models/commit.rb - About 1 day to fix

          File file_icon_map.js has 586 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          const fileExtensionIcons = {
            html: 'html',
            htm: 'html',
            html_vm: 'html',
            asp: 'html',

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

            class NotificationService
              class Async
                attr_reader :parent
                delegate :respond_to_missing, to: :parent
            
            
            Severity: Major
            Found in app/services/notification_service.rb - About 1 day to fix

              File filtered_search_manager.js has 551 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import _ from 'underscore';
              import { getParameterByName, getUrlParamsArray } from '~/lib/utils/common_utils';
              import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys';
              import recentSearchesStorageKeys from 'ee_else_ce/filtered_search/recent_searches_storage_keys';
              import { visitUrl } from '../lib/utils/url_utility';
              Severity: Major
              Found in app/assets/javascripts/filtered_search/filtered_search_manager.js - About 1 day to fix

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

                class ApplicationController < ActionController::Base
                  include Gitlab::GonHelper
                  include GitlabRoutingHelper
                  include PageLayoutHelper
                  include SafeParamsHelper
                Severity: Major
                Found in app/controllers/application_controller.rb - About 1 day to fix

                  Class File has 62 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      class File
                        include Gitlab::Utils::StrongMemoize
                  
                        attr_reader :diff, :repository, :diff_refs, :fallback_diff_refs, :unique_identifier
                  
                  
                  Severity: Major
                  Found in lib/gitlab/diff/file.rb - About 1 day to fix

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

                    /* eslint-disable no-useless-return, func-names, no-var, no-underscore-dangle, prefer-arrow-callback, one-var, no-unused-vars, prefer-template, no-new, consistent-return, object-shorthand, no-shadow, no-param-reassign, vars-on-top, no-lonely-if, no-else-return, dot-notation, no-empty */
                    /* global Issuable */
                    /* global ListLabel */
                    
                    import $ from 'jquery';
                    Severity: Major
                    Found in app/assets/javascripts/labels_select.js - About 1 day to fix

                      File migration_helpers.rb has 539 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: Major
                      Found in lib/gitlab/database/migration_helpers.rb - About 1 day to fix

                        File projects_helper.rb has 537 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        module ProjectsHelper
                          def link_to_project(project)
                            link_to namespace_project_path(namespace_id: project.namespace, id: project), title: h(project.name) do
                              title = content_tag(:span, project.name, class: 'project-name')
                        
                        
                        Severity: Major
                        Found in app/helpers/projects_helper.rb - About 1 day to fix

                          Class IssuableFinder has 61 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class IssuableFinder
                            prepend FinderWithCrossProjectAccess
                            include FinderMethods
                            include CreatedAtFilter
                            include Gitlab::Utils::StrongMemoize
                          Severity: Major
                          Found in app/finders/issuable_finder.rb - About 1 day to fix

                            Class Note has 61 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            class Note < ApplicationRecord
                              extend ActiveModel::Naming
                              include Participable
                              include Mentionable
                              include Awardable
                            Severity: Major
                            Found in app/models/note.rb - About 1 day to fix

                              Function init has 217 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                static init(els, options) {
                                  let $els = $(els);
                              
                                  if (!els) {
                                    $els = $('.js-milestone-select');
                              Severity: Major
                              Found in app/assets/javascripts/milestone_select.js - About 1 day to fix

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

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

                                  Function dropzoneInput has 216 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export default function dropzoneInput(form) {
                                    const divHover = '<div class="div-dropzone-hover"></div>';
                                    const iconPaperclip = '<i class="fa fa-paperclip div-dropzone-icon"></i>';
                                    const $attachButton = form.find('.button-attach-file');
                                    const $attachingFileMessage = form.find('.attaching-file-message');
                                  Severity: Major
                                  Found in app/assets/javascripts/dropzone_input.js - About 1 day to fix

                                    Function jumpToNextUnresolvedDiscussion has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        jumpToNextUnresolvedDiscussion: function() {
                                          let discussionsSelector;
                                          let discussionIdsInScope;
                                          let firstUnresolvedDiscussionId;
                                          let nextUnresolvedDiscussionId;
                                    Severity: Minor
                                    Found in app/assets/javascripts/diff_notes/components/jump_to_discussion.js - About 1 day 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

                                    File common_utils.js has 510 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    /**
                                     * @module common-utils
                                     */
                                    
                                    import $ from 'jquery';
                                    Severity: Major
                                    Found in app/assets/javascripts/lib/utils/common_utils.js - About 1 day to fix

                                      Function Keyboard has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      const Keyboard = function() {
                                        var currentKey;
                                        var currentFocus;
                                        var isUpArrow = false;
                                        var isDownArrow = false;
                                      Severity: Minor
                                      Found in app/assets/javascripts/droplab/keyboard.js - About 7 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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language