gitlabhq/gitlabhq

View on GitHub

Showing 1,432 of 2,076 total issues

File merge_conflict_store.js has 355 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable object-shorthand, no-param-reassign, camelcase, no-nested-ternary, no-continue */

import $ from 'jquery';
import Vue from 'vue';
import Cookies from 'js-cookie';
Severity: Minor
Found in app/assets/javascripts/merge_conflicts/merge_conflict_store.js - About 4 hrs to fix

    File datetime_utility.js has 355 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import $ from 'jquery';
    import _ from 'underscore';
    import timeago from 'timeago.js';
    import dateFormat from 'dateformat';
    import { pluralize } from './text_utility';
    Severity: Minor
    Found in app/assets/javascripts/lib/utils/datetime_utility.js - About 4 hrs to fix

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

      class WikiPage
        PageChangedError = Class.new(StandardError)
        PageRenameError = Class.new(StandardError)
      
        include ActiveModel::Validations
      Severity: Minor
      Found in app/models/wiki_page.rb - About 4 hrs to fix

        File issuables_helper.rb has 353 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

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

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

            Method unfold_required? has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
            Open

                  def unfold_required?
                    strong_memoize(:unfold_required) do
                      next false unless @diff_file.text?
                      next false unless @position.on_text? && @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

            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 350 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

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

                      class AbstractReferenceFilter < ReferenceFilter
                        include CrossProjectReference
                  
                        def self.object_class
                          # Implement in child class
                  Severity: Minor
                  Found in lib/banzai/filter/abstract_reference_filter.rb - About 4 hrs to fix

                    File repository_service.rb has 345 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

                      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 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 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 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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language