gitlabhq/gitlabhq

View on GitHub

Showing 1,405 of 2,015 total issues

File object_storage.rb has 315 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'fog/aws'
require 'carrierwave/storage/fog'

#
# This concern should add object storage support
Severity: Minor
Found in app/uploaders/object_storage.rb - About 3 hrs to fix

    File git_access.rb has 314 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      File issues.rb has 314 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

        Function getData has 88 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          getData(term, callback) {
            if (!term) {
              const contents = this.getCategoryContents();
              if (contents) {
                const glDropdownInstance = this.searchInput.data('glDropdown');
        Severity: Major
        Found in app/assets/javascripts/search_autocomplete.js - About 3 hrs to fix

          File ee_compat_check.rb has 313 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module Gitlab
            # Checks if a set of migrations requires downtime or not.
            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
          Severity: Minor
          Found in lib/gitlab/ee_compat_check.rb - About 3 hrs to fix

            FileTemplateMediator has 29 functions (exceeds 20 allowed). Consider refactoring.
            Open

            export default class FileTemplateMediator {
              constructor({ editor, currentAction, projectId }) {
                this.editor = editor;
                this.currentAction = currentAction;
                this.projectId = projectId;
            Severity: Minor
            Found in app/assets/javascripts/blob/file_template_mediator.js - About 3 hrs to fix

              Api has 29 functions (exceeds 20 allowed). Consider refactoring.
              Open

              const Api = {
                groupsPath: '/api/:version/groups.json',
                groupPath: '/api/:version/groups/:id',
                groupMembersPath: '/api/:version/groups/:id/members',
                subgroupsPath: '/api/:version/groups/:id/subgroups',
              Severity: Minor
              Found in app/assets/javascripts/api.js - About 3 hrs to fix

                Class Environment has 29 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Environment < ApplicationRecord
                  include Gitlab::Utils::StrongMemoize
                  # Used to generate random suffixes for the slug
                  LETTERS = ('a'..'z').freeze
                  NUMBERS = ('0'..'9').freeze
                Severity: Minor
                Found in app/models/environment.rb - About 3 hrs to fix

                  Class Label has 29 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Label < ApplicationRecord
                    include CacheMarkdownField
                    include Referable
                    include Subscribable
                    include Gitlab::SQL::Pattern
                  Severity: Minor
                  Found in app/models/label.rb - About 3 hrs to fix

                    Class ProjectWiki has 29 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class ProjectWiki
                      include Gitlab::ShellAdapter
                      include Storage::LegacyProjectWiki
                    
                      MARKUPS = {
                    Severity: Minor
                    Found in app/models/project_wiki.rb - About 3 hrs to fix

                      Class ProjectTeam has 29 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class ProjectTeam
                        include BulkMemberAccessLoad
                      
                        attr_accessor :project
                      
                      
                      Severity: Minor
                      Found in app/models/project_team.rb - About 3 hrs to fix

                        File file.rb has 312 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        module Gitlab
                          module Diff
                            class File
                              include Gitlab::Utils::StrongMemoize
                        
                        
                        Severity: Minor
                        Found in lib/gitlab/diff/file.rb - About 3 hrs to fix

                          Function chooseTemplate has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            function chooseTemplate() {
                              $projectTemplateButtons.addClass('hidden');
                              $projectFieldsForm.addClass('selected');
                              $selectedIcon.empty();
                              const value = $(this).val();
                          Severity: Major
                          Found in app/assets/javascripts/projects/project_new.js - About 3 hrs to fix

                            File event.rb has 310 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            class Event < ApplicationRecord
                              include Sortable
                              include IgnorableColumn
                              include FromUnion
                              default_scope { reorder(nil) }
                            Severity: Minor
                            Found in app/models/event.rb - About 3 hrs to fix

                              Function addIssue has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                              Open

                                addIssue(issue, listFrom, newIndex) {
                                  let moveBeforeId = null;
                                  let moveAfterId = null;
                              
                                  if (!this.findIssue(issue.id)) {
                              Severity: Minor
                              Found in app/assets/javascripts/boards/models/list.js - 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 keydownNoteText has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                              Open

                                keydownNoteText(e) {
                                  var $textarea,
                                    discussionNoteForm,
                                    editNote,
                                    myLastNote,
                              Severity: Minor
                              Found in app/assets/javascripts/notes.js - 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 sections has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                              Open

                                    def sections
                                      return @sections if @sections
                              
                                      chunked_lines = lines.chunk { |line| line.type.nil? }.to_a
                                      match_line = nil
                              Severity: Minor
                              Found in lib/gitlab/conflict/file.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 ContributorsGraph has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const ContributorsGraph = (function() {
                                function ContributorsGraph() {}
                              
                                ContributorsGraph.prototype.MARGIN = {
                                  top: 20,

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