gitlabhq/gitlabhq

View on GitHub

Showing 2,950 of 2,950 total issues

File common_utils.js has 473 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @module common-utils
 */

import { GlBreakpointInstance as breakpointInstance } from '@gitlab/ui/dist/utils';
Severity: Minor
Found in app/assets/javascripts/lib/utils/common_utils.js - About 7 hrs to fix

    Class Event has 52 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Event < ApplicationRecord
      include Sortable
      include FromUnion
      include Presentable
      include DeleteWithLimit
    Severity: Major
    Found in app/models/event.rb - About 7 hrs to fix

      Class Namespace has 52 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Namespace < ApplicationRecord
        include CacheMarkdownField
        include Sortable
        include Gitlab::VisibilityLevel
        include Routable
      Severity: Major
      Found in app/models/namespace.rb - About 7 hrs to fix

        File group.rb has 462 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'carrierwave/orm/activerecord'
        
        class Group < Namespace
          include Gitlab::ConfigHelper
          include AfterCommitQueue
        Severity: Minor
        Found in app/models/group.rb - About 7 hrs to fix

          File merge_request_diff.rb has 451 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 48 methods (exceeds 20 allowed). Consider refactoring.
            Open

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

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

              class Environment < ApplicationRecord
                include Gitlab::Utils::StrongMemoize
                include ReactiveCaching
                include FastDestroyAll::Helpers
              
              
              Severity: Minor
              Found in app/models/environment.rb - About 6 hrs to fix

                Function insertMarkdownText has a Cognitive Complexity of 43 (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

                Method each_pair has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                Open

                        def each_pair
                          state = :key
                          key = StringIO.new
                          value = StringIO.new
                          hex_buffer = ""
                Severity: Minor
                Found in lib/gitlab/auth/ldap/dn.rb - 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

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

                const updateImageDiffNoteInStore = (store, updateImageDiffNote, query, variables) => {
                  const data = store.readQuery({
                    query,
                    variables,
                  });
                app/assets/javascripts/design_management_legacy/utils/cache_update.js on lines 139..164

                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 166.

                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

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

                const updateImageDiffNoteInStore = (store, updateImageDiffNote, query, variables) => {
                  const data = store.readQuery({
                    query,
                    variables,
                  });
                app/assets/javascripts/design_management/utils/cache_update.js on lines 139..164

                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 166.

                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

                Method visible_attributes has 161 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 note.rb has 433 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

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

                    File application_controller.rb has 432 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'gon'
                    require 'fogbugz'
                    
                    class ApplicationController < ActionController::Base
                      include Gitlab::GonHelper
                    Severity: Minor
                    Found in app/controllers/application_controller.rb - About 6 hrs to fix

                      `` has 46 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 6 hrs to fix

                        Class JiraService has 46 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class JiraService < IssueTrackerService
                          extend ::Gitlab::Utils::Override
                          include Gitlab::Routing
                          include ApplicationHelper
                          include ActionView::Helpers::AssetUrlHelper
                        Severity: Minor
                        Found in app/models/project_services/jira_service.rb - About 6 hrs to fix

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

                          class WikiPage
                            include Gitlab::Utils::StrongMemoize
                          
                            PageChangedError = Class.new(StandardError)
                            PageRenameError = Class.new(StandardError)
                          Severity: Minor
                          Found in app/models/wiki_page.rb - About 6 hrs to fix

                            Class ProjectPresenter has 45 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

                              File create_merge_request_dropdown.js has 423 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              /* eslint-disable no-new */
                              import { debounce } from 'lodash';
                              import axios from './lib/utils/axios_utils';
                              import Flash from './flash';
                              import DropLab from './droplab/drop_lab';
                              Severity: Minor
                              Found in app/assets/javascripts/create_merge_request_dropdown.js - About 6 hrs to fix

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

                                  rowClicked(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

                                Severity
                                Category
                                Status
                                Source
                                Language