gitlabhq/gitlabhq

View on GitHub

Showing 1,391 of 2,006 total issues

Class IssuableBaseService has 35 methods (exceeds 20 allowed). Consider refactoring.
Open

class IssuableBaseService < BaseService
  private

  attr_accessor :params, :skip_milestone_email

Severity: Minor
Found in app/services/issuable_base_service.rb - About 4 hrs to fix

    File issuables_helper.rb has 352 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module IssuablesHelper
      include GitlabRoutingHelper
    
      def sidebar_gutter_toggle_icon
        sidebar_gutter_collapsed? ? icon('angle-double-left', { 'aria-hidden': 'true' }) : icon('angle-double-right', { 'aria-hidden': 'true' })
    Severity: Minor
    Found in app/helpers/issuables_helper.rb - About 4 hrs to fix

      File note.rb has 350 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

        File projects_controller.rb has 348 lines of code (exceeds 250 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 4 hrs to fix

          Class NotifyPreview has 34 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class NotifyPreview < ActionMailer::Preview
            def note_merge_request_email_for_individual_note
              note_email(:note_merge_request_email) do
                note = <<-MD.strip_heredoc
                  This is an individual note on a merge request :smiley:
          Severity: Minor
          Found in app/mailers/previews/notify_preview.rb - About 4 hrs to fix

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

                def run(debug = nil)
                  @state = State.new
            
                  steps_by_score do |step, score|
                    break if !debug && @state.prevented?
            Severity: Minor
            Found in lib/declarative_policy/runner.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 unfold_required? has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
            Open

                  def unfold_required?
                    strong_memoize(:unfold_required) do
                      next false unless @diff_file.text?
                      next false unless @position.unchanged?
                      next false if @diff_file.new_file? || @diff_file.deleted_file?
            Severity: Minor
            Found in lib/gitlab/diff/lines_unfolder.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 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

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

              class Import::GithubController < Import::BaseController
                include ImportHelper
              
                before_action :verify_import_enabled
                before_action :provider_auth, only: [:status, :realtime_changes, :create]
              Severity: Minor
              Found in app/controllers/import/github_controller.rb - About 4 hrs to fix

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

                class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationController
                  include ToggleSubscriptionAction
                  include IssuableActions
                  include RendersNotes
                  include RendersCommits
                Severity: Minor
                Found in app/controllers/projects/merge_requests_controller.rb - 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

                        File repository_service.rb has 340 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        module Gitlab
                          module GitalyClient
                            class RepositoryService
                              include Gitlab::EncodingHelper
                        
                        
                        Severity: Minor
                        Found in lib/gitlab/gitaly_client/repository_service.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

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

                              setData(data, isRebased) {
                                if (isRebased) {
                                  this.sha = data.diff_head_sha;
                                }
                            
                            

                              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

                              File stat_graph_contributors_graph.js has 335 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';
                                Severity
                                Category
                                Status
                                Source
                                Language