gitlabhq/gitlabhq

View on GitHub

Showing 2,388 of 2,388 total issues

File merge_request_diff.rb has 424 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 6 hrs to fix

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

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export function startPollingDetails({ commit }, endpoint) {
        detailPoll = new Poll({
          resource: service,
          method: 'getSentryData',
          data: { endpoint },
      app/assets/javascripts/error_tracking/store/details/actions.js on lines 38..59

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 157.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export function startPollingStacktrace({ commit }, endpoint) {
        stackTracePoll = new Poll({
          resource: service,
          method: 'getSentryData',
          data: { endpoint },
      app/assets/javascripts/error_tracking/store/details/actions.js on lines 14..36

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 157.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function rowClicked has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

      GitLabDropdown.prototype.rowClicked = function(el) {
        let field, groupName, selectedIndex, selectedObject, isMarking;
        const { fieldName } = this.options;
        const isInput = $(this.el).is('input');
        if (this.renderedData) {
      Severity: Minor
      Found in app/assets/javascripts/gl_dropdown.js - 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

      Function insertMarkdownText has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
      Open

      export function insertMarkdownText({
        textArea,
        text,
        tag,
        cursorOffset,
      Severity: Minor
      Found in app/assets/javascripts/lib/utils/text_markdown.js - 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

      File notification_service.rb has 419 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class NotificationService
        class Async
          attr_reader :parent
          delegate :respond_to_missing, to: :parent
      
      
      Severity: Minor
      Found in app/services/notification_service.rb - About 6 hrs to fix

        Method visible_attributes has 151 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 6 hrs to fix

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

          module API
            module Helpers
              include Gitlab::Utils
              include Helpers::Pagination
              include Helpers::PaginationStrategies
          Severity: Minor
          Found in lib/api/helpers.rb - About 6 hrs to fix

            Class Service has 44 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 6 hrs to fix

              Class ProjectsController has 44 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 6 hrs to fix

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

                class ProjectPresenter < Gitlab::View::Presenter::Delegated
                  include ActionView::Helpers::NumberHelper
                  include ActionView::Helpers::UrlHelper
                  include GitlabRoutingHelper
                  include StorageHelper
                Severity: Minor
                Found in app/presenters/project_presenter.rb - About 6 hrs to fix

                  Class TodoService has 44 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 6 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

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

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

                        File project_policy.rb has 406 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

                          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 JiraService has 42 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

                              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 operation_service.rb has 399 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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language