gitlabhq/gitlabhq

View on GitHub

Showing 1,532 of 1,532 total issues

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

    class Commit
      include Gitlab::EncodingHelper

      attr_accessor :raw_commit, :head

Severity: Major
Found in lib/gitlab/git/commit.rb - About 7 hrs to fix

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

    class Note < ActiveRecord::Base
      extend ActiveModel::Naming
      include Participable
      include Mentionable
      include Awardable
    Severity: Major
    Found in app/models/note.rb - About 7 hrs to fix

      Class IssuableFinder has 50 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class IssuableFinder
        include CreatedAtFilter
      
        NONE = '0'.freeze
      
      
      Severity: Minor
      Found in app/finders/issuable_finder.rb - About 7 hrs to fix

        Class File has 49 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class File
              attr_reader :diff, :repository, :diff_refs, :fallback_diff_refs
        
              delegate :new_file?, :deleted_file?, :renamed_file?,
                :old_path, :new_path, :a_mode, :b_mode, :mode_changed?,
        Severity: Minor
        Found in lib/gitlab/diff/file.rb - About 6 hrs to fix

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

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

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

                if (textarea.val().trim().length > 0) {
                  reopentext = reopenbtn.attr('data-alternative-text');
                  closetext = closebtn.attr('data-alternative-text');
                  if (reopenbtn.text() !== reopentext) {
                    reopenbtn.text(reopentext);
            Severity: Major
            Found in app/assets/javascripts/notes.js and 1 other location - About 6 hrs to fix
            app/assets/javascripts/notes.js on lines 1124..1142

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

            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

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

                } else {
                  reopentext = reopenbtn.data('original-text');
                  closetext = closebtn.data('original-text');
                  if (reopenbtn.text() !== reopentext) {
                    reopenbtn.text(reopentext);
            Severity: Major
            Found in app/assets/javascripts/notes.js and 1 other location - About 6 hrs to fix
            app/assets/javascripts/notes.js on lines 1106..1124

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

            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 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/background_migration/normalize_ldap_extern_uids_range.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

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

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

            export default function projectAvatar() {
              $('.js-choose-project-avatar-button').bind('click', function onClickAvatar() {
                const form = $(this).closest('form');
                return form.find('.js-project-avatar-input').click();
              });
            app/assets/javascripts/group_avatar.js on lines 1..13

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

            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

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

            export default function groupAvatar() {
              $('.js-choose-group-avatar-button').on('click', function onClickGroupAvatar() {
                const form = $(this).closest('form');
                return form.find('.js-group-avatar-input').click();
              });
            Severity: Major
            Found in app/assets/javascripts/group_avatar.js and 1 other location - About 6 hrs to fix
            app/assets/javascripts/pages/projects/shared/project_avatar.js on lines 1..14

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

            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

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

            class NotificationService
              # Always notify user about ssh key added
              # only if ssh key is not deploy key
              #
              # This is security email so it will be sent
            Severity: Minor
            Found in app/services/notification_service.rb - About 6 hrs to fix

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

              class Group < Namespace
                include Gitlab::ConfigHelper
                include AfterCommitQueue
                include AccessRequestable
                include Avatarable
              Severity: Minor
              Found in app/models/group.rb - About 6 hrs to fix

                File migration_helpers.rb has 422 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                module Gitlab
                  module Database
                    module MigrationHelpers
                      BACKGROUND_MIGRATION_BATCH_SIZE = 1000 # Number of rows to process per job
                      BACKGROUND_MIGRATION_JOB_BUFFER_SIZE = 1000 # Number of jobs to bulk queue at a time
                Severity: Minor
                Found in lib/gitlab/database/migration_helpers.rb - About 6 hrs to fix

                  File labels_select.js has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /* eslint-disable no-useless-return, func-names, space-before-function-paren, wrap-iife, no-var, no-underscore-dangle, prefer-arrow-callback, max-len, one-var, no-unused-vars, one-var-declaration-per-line, prefer-template, no-new, consistent-return, object-shorthand, comma-dangle, no-shadow, no-param-reassign, brace-style, vars-on-top, quotes, no-lonely-if, no-else-return, dot-notation, no-empty, no-return-assign, camelcase, prefer-spread */
                  /* global Issuable */
                  /* global ListLabel */
                  import _ from 'underscore';
                  import { __ } from './locale';
                  Severity: Minor
                  Found in app/assets/javascripts/labels_select.js - About 6 hrs to fix

                    Class ApplicationController has 44 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class ApplicationController < ActionController::Base
                      include Gitlab::GonHelper
                      include GitlabRoutingHelper
                      include PageLayoutHelper
                      include SentryHelper
                    Severity: Minor
                    Found in app/controllers/application_controller.rb - About 6 hrs to fix

                      Function GitLabDropdown has 149 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function GitLabDropdown(el1, options) {
                          var searchFields, selector, self;
                          this.el = el1;
                          this.options = options;
                          this.updateLabel = this.updateLabel.bind(this);
                      Severity: Major
                      Found in app/assets/javascripts/gl_dropdown.js - About 5 hrs to fix

                        File projects.rb has 410 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require_dependency 'declarative_policy'
                        
                        module API
                          class Projects < Grape::API
                            include PaginationParams
                        Severity: Minor
                        Found in lib/api/projects.rb - About 5 hrs to fix

                          Class TodoService has 43 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class TodoService
                            # When create an issue we should:
                            #
                            #  * create a todo for assignee if issue is assigned
                            #  * create a todo for each mentioned user on issue
                          Severity: Minor
                          Found in app/services/todo_service.rb - About 5 hrs to fix

                            File projects.rb has 406 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            module API
                              module V3
                                class Projects < Grape::API
                                  include PaginationParams
                            
                            
                            Severity: Minor
                            Found in lib/api/v3/projects.rb - About 5 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language