gitlabhq/gitlabhq

View on GitHub

Showing 1,432 of 2,076 total issues

File issues.rb has 309 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module API
  class Issues < Grape::API
    include PaginationParams
    helpers Helpers::IssuesHelpers
    helpers ::Gitlab::IssuableMetadata
Severity: Minor
Found in lib/api/issues.rb - About 3 hrs to fix

    File project_presenter.rb has 308 lines of code (exceeds 250 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 3 hrs to fix

      `` has 28 functions (exceeds 20 allowed). Consider refactoring.
      Open

      export default {
        [types.ADD_NEW_NOTE](state, data) {
          const note = data.discussion ? data.discussion.notes[0] : data;
          const { discussion_id, type } = note;
          const [exists] = state.discussions.filter(n => n.id === note.discussion_id);
      Severity: Minor
      Found in app/assets/javascripts/notes/stores/mutations.js - About 3 hrs to fix

        SearchAutocomplete has 28 functions (exceeds 20 allowed). Consider refactoring.
        Open

        export class SearchAutocomplete {
          constructor({ wrap, optsEl, autocompletePath, projectId, projectRef } = {}) {
            setSearchOptions();
            this.bindEventContext();
            this.wrap = wrap || $('.search');
        Severity: Minor
        Found in app/assets/javascripts/search_autocomplete.js - About 3 hrs to fix

          Class RemoteMirror has 28 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class RemoteMirror < ApplicationRecord
            include AfterCommitQueue
            include MirrorAuthentication
          
            PROTECTED_BACKOFF_DELAY   = 1.minute
          Severity: Minor
          Found in app/models/remote_mirror.rb - About 3 hrs to fix

            Class Base has 28 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class Base
                  def initialize(*)
                    raise 'abstract'
                  end
            
            
            Severity: Minor
            Found in app/services/notification_recipient_service.rb - About 3 hrs to fix

              Class GeneratePerfTestdata has 28 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class GeneratePerfTestdata
                    include Support::Api
              
                    def initialize
                      raise ArgumentError, "Please provide GITLAB_ADDRESS" unless ENV['GITLAB_ADDRESS']
              Severity: Minor
              Found in qa/qa/tools/generate_perf_testdata.rb - About 3 hrs to fix

                File qa.rb has 305 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                $: << File.expand_path(File.dirname(__FILE__))
                
                Encoding.default_external = 'UTF-8'
                
                module QA
                Severity: Minor
                Found in qa/qa.rb - About 3 hrs to fix

                  Method validate! has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def validate!(
                          url,
                          ports: [],
                          schemes: [],
                          allow_localhost: false,
                  Severity: Minor
                  Found in lib/gitlab/url_blocker.rb - About 3 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 match_entries has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                            def match_entries(gz)
                              entries = {}
                  
                              child_pattern = '[^/]*/?$' unless @opts[:recursive]
                              match_pattern = /^#{Regexp.escape(@path)}#{child_pattern}/
                  Severity: Minor
                  Found in lib/gitlab/ci/build/artifacts/metadata.rb - About 3 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 initMergeConflicts has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export default function initMergeConflicts() {
                    const INTERACTIVE_RESOLVE_MODE = 'interactive';
                    const conflictsEl = document.querySelector('#conflicts');
                    const { mergeConflictsStore } = gl.mergeConflicts;
                    const mergeConflictsService = new MergeConflictsService({
                  Severity: Major
                  Found in app/assets/javascripts/merge_conflicts/merge_conflicts_bundle.js - About 3 hrs to fix

                    Method defaults has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def defaults
                          {
                            after_sign_up_text: nil,
                            akismet_enabled: false,
                            allow_local_requests_from_hooks_and_services: false,
                    Severity: Major
                    Found in app/models/application_setting_implementation.rb - About 3 hrs to fix

                      File commits.rb has 301 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require 'mime/types'
                      
                      module API
                        class Commits < Grape::API
                          include PaginationParams
                      Severity: Minor
                      Found in lib/api/commits.rb - About 3 hrs to fix

                        Function renderItem has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          GitLabDropdown.prototype.renderItem = function(data, group, index) {
                            var field, html, selected, text, url, value, rowHidden;
                        
                            if (!this.options.renderRow) {
                              value = this.options.id ? this.options.id(data) : data.id;
                        Severity: Major
                        Found in app/assets/javascripts/gl_dropdown.js - About 3 hrs to fix

                          Class HipchatService has 27 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class HipchatService < Service
                            include ActionView::Helpers::SanitizeHelper
                          
                            MAX_COMMITS = 3
                            HIPCHAT_ALLOWED_TAGS = %w[
                          Severity: Minor
                          Found in app/models/project_services/hipchat_service.rb - About 3 hrs to fix

                            Class FileUploader has 27 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                            class FileUploader < GitlabUploader
                              include UploaderHelper
                              include RecordsUploads::Concern
                              include ObjectStorage::Concern
                              prepend ObjectStorage::Extension::RecordsUploads
                            Severity: Minor
                            Found in app/uploaders/file_uploader.rb - About 3 hrs to fix

                              Class Position has 27 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                                  class Position
                                    attr_accessor :formatter
                              
                                    delegate :old_path,
                                             :new_path,
                              Severity: Minor
                              Found in lib/gitlab/diff/position.rb - About 3 hrs to fix

                                Method cards has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def cards
                                      [
                                        Card.new(
                                          metric: subject,
                                          title: 'Issues',
                                Severity: Major
                                Found in app/presenters/conversational_development_index/metric_presenter.rb - About 3 hrs to fix

                                  File boards_store.js has 297 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  /* eslint-disable no-shadow */
                                  /* global List */
                                  
                                  import $ from 'jquery';
                                  import _ from 'underscore';
                                  Severity: Minor
                                  Found in app/assets/javascripts/boards/stores/boards_store.js - About 3 hrs to fix

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

                                      def has_access?
                                        DeclarativePolicy.subject_scope do
                                          break false unless user.can?(:receive_notifications)
                                          break true if @skip_read_ability
                                    
                                    
                                    Severity: Minor
                                    Found in app/models/notification_recipient.rb - About 3 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