gitlabhq/gitlabhq

View on GitHub

Showing 1,623 of 2,301 total issues

File actions.js has 414 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import Vue from 'vue';
import axios from '~/lib/utils/axios_utils';
import Cookies from 'js-cookie';
import createFlash from '~/flash';
import { s__ } from '~/locale';
Severity: Minor
Found in app/assets/javascripts/diffs/store/actions.js - About 5 hrs to fix

    Method visible_attributes has 148 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def visible_attributes
        [
          :admin_notification_email,
          :after_sign_out_path,
          :after_sign_up_text,
    Severity: Major
    Found in app/helpers/application_settings_helper.rb - About 5 hrs to fix

      File helpers.rb has 412 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module API
        module Helpers
          include Gitlab::Utils
          include Helpers::Pagination
      
      
      Severity: Minor
      Found in lib/api/helpers.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

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

            class GitAccess
              include Gitlab::Utils::StrongMemoize
          
              UnauthorizedError = Class.new(StandardError)
              NotFoundError = Class.new(StandardError)
          Severity: Minor
          Found in lib/gitlab/git_access.rb - About 5 hrs to fix

            Function postComment has 143 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

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

              class Service < ApplicationRecord
                include Sortable
                include Importable
                include ProjectServicesLoggable
                include DataFields
              Severity: Minor
              Found in app/models/service.rb - About 5 hrs to fix

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

                function GitLabDropdown(el1, options) {
                  let 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 merge_request_diff.rb has 401 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  class MergeRequestDiff < ApplicationRecord
                    include Sortable
                    include Importable
                    include ManualInverseAssociation
                    include EachBatch
                  Severity: Minor
                  Found in app/models/merge_request_diff.rb - About 5 hrs to fix

                    File project_policy.rb has 401 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    class ProjectPolicy < BasePolicy
                      extend ClassMethods
                    
                      READONLY_FEATURES_WHEN_ARCHIVED = %i[
                        issue
                    Severity: Minor
                    Found in app/policies/project_policy.rb - About 5 hrs to fix

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

                      /* eslint-disable no-return-assign, consistent-return, class-methods-use-this */
                      
                      import $ from 'jquery';
                      import { escape, throttle } from 'underscore';
                      import { s__, __ } from '~/locale';
                      Severity: Minor
                      Found in app/assets/javascripts/search_autocomplete.js - About 5 hrs to fix

                        File operation_service.rb has 398 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        module Gitlab
                          module GitalyClient
                            class OperationService
                              include Gitlab::EncodingHelper
                        
                        
                        Severity: Minor
                        Found in lib/gitlab/gitaly_client/operation_service.rb - About 5 hrs to fix

                          File merge_requests.rb has 396 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          module API
                            class MergeRequests < Grape::API
                              include PaginationParams
                          
                              before { authenticate_non_get! }
                          Severity: Minor
                          Found in lib/api/merge_requests.rb - About 5 hrs to fix

                            Class Config has 41 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                                  class Config
                                    prepend_if_ee('::EE::Gitlab::Auth::LDAP::Config') # rubocop: disable Cop/InjectEnterpriseEditionModule
                            
                                    NET_LDAP_ENCRYPTION_METHOD = {
                                      simple_tls: :simple_tls,
                            Severity: Minor
                            Found in lib/gitlab/auth/ldap/config.rb - About 5 hrs to fix

                              File actions.js has 393 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import Vue from 'vue';
                              import $ from 'jquery';
                              import axios from '~/lib/utils/axios_utils';
                              import Visibility from 'visibilityjs';
                              import TaskList from '../../task_list';
                              Severity: Minor
                              Found in app/assets/javascripts/notes/stores/actions.js - About 5 hrs to fix

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

                                class ProjectsController < Projects::ApplicationController
                                  include API::Helpers::RelatedResourcesHelpers
                                  include IssuableCollections
                                  include ExtractsPath
                                  include PreviewMarkdown
                                Severity: Minor
                                Found in app/controllers/projects_controller.rb - About 5 hrs to fix

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

                                      class RepositoryService
                                        include Gitlab::EncodingHelper
                                  
                                        MAX_MSG_SIZE = 128.kilobytes
                                  
                                  
                                  Severity: Minor
                                  Found in lib/gitlab/gitaly_client/repository_service.rb - About 5 hrs to fix

                                    Function GitLabDropdown has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    function GitLabDropdown(el1, options) {
                                      let selector, self;
                                      this.el = el1;
                                      this.options = options;
                                      this.updateLabel = this.updateLabel.bind(this);
                                    Severity: Minor
                                    Found in app/assets/javascripts/gl_dropdown.js - About 5 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 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/auth/ldap/dn.rb - About 5 hrs to fix

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

                                      class JiraService < IssueTrackerService
                                        include Gitlab::Routing
                                        include ApplicationHelper
                                        include ActionView::Helpers::AssetUrlHelper
                                      
                                      
                                      Severity: Minor
                                      Found in app/models/project_services/jira_service.rb - About 5 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language