gitlabhq/gitlabhq

View on GitHub

Showing 99 of 111 total issues

Class Project has 56 methods (exceeds 20 allowed). Consider refactoring.
Open

class Project < ActiveRecord::Base
  include Gitlab::ShellAdapter
  extend Enumerize

  attr_accessible :name, :path, :description, :default_branch, :issues_tracker, :label_list,
Severity: Major
Found in app/models/project.rb - About 1 day to fix

    Function md5 has 185 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function md5 (str) {
      // http://kevin.vanzonneveld.net
      // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
      // + namespaced by: Michael White (http://getsprink.com)
      // +    tweaked by: Jack
    Severity: Major
    Found in app/assets/javascripts/lib/md5.js - About 7 hrs to fix

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

      class Event < ActiveRecord::Base
        attr_accessible :project, :action, :data, :author_id, :project_id,
                        :target_id, :target_type
      
        default_scope where("author_id IS NOT NULL")
      Severity: Minor
      Found in app/models/event.rb - About 6 hrs to fix

        Class User has 39 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class User < ActiveRecord::Base
          devise :database_authenticatable, :token_authenticatable, :lockable,
                 :recoverable, :rememberable, :trackable, :validatable, :omniauthable, :registerable
        
          attr_accessible :email, :password, :password_confirmation, :remember_me, :bio, :name, :username,
        Severity: Minor
        Found in app/models/user.rb - About 5 hrs to fix

          Method each has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
          Open

              def each
                line_old = 1
                line_new = 1
                type = nil
          
          
          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

          Class MergeRequest has 31 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class MergeRequest < ActiveRecord::Base
            include Issuable
            include InternalId
          
            belongs_to :target_project, foreign_key: :target_project_id, class_name: "Project"
          Severity: Minor
          Found in app/models/merge_request.rb - About 3 hrs to fix

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

            require "grit"
            
            class Project < ActiveRecord::Base
              include Gitlab::ShellAdapter
              extend Enumerize
            Severity: Minor
            Found in app/models/project.rb - About 3 hrs to fix

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

              class Note < ActiveRecord::Base
                include Mentionable
              
                attr_accessible :note, :noteable, :noteable_id, :noteable_type, :project_id,
                                :attachment, :line_code, :commit_id
              Severity: Minor
              Found in app/models/note.rb - About 3 hrs to fix

                Function utf8_encode has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                function utf8_encode (argString) {
                  // http://kevin.vanzonneveld.net
                  // +   original by: Webtoolkit.info (http://www.webtoolkit.info/)
                  // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
                  // +   improved by: sowberry
                Severity: Minor
                Found in app/assets/javascripts/lib/utf8_encode.js - About 2 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

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

                class ApplicationController < ActionController::Base
                  before_filter :authenticate_user!
                  before_filter :reject_blocked!
                  before_filter :check_password_expiration
                  before_filter :set_current_user_for_thread
                Severity: Minor
                Found in app/controllers/application_controller.rb - About 2 hrs to fix

                  File notes.js has 282 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  var NoteList = {
                    id: null,
                    notes_path: null,
                    target_params: null,
                    target_id: 0,
                  Severity: Minor
                  Found in app/assets/javascripts/notes.js - About 2 hrs to fix

                    Method processing has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def processing diff_arr
                            indexes = _indexes_of_changed_lines diff_arr
                    
                            indexes.each do |index|
                              first_line = diff_arr[index+1]
                    Severity: Minor
                    Found in lib/gitlab/inline_diff.rb - About 2 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

                    NoteList has 24 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    var NoteList = {
                      id: null,
                      notes_path: null,
                      target_params: null,
                      target_id: 0,
                    Severity: Minor
                    Found in app/assets/javascripts/notes.js - About 2 hrs to fix

                      Method tree_breadcrumbs has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def tree_breadcrumbs(tree, max_links = 2)
                          if tree.path
                            part_path = ""
                            parts = tree.path.split("\/")
                      
                      
                      Severity: Minor
                      Found in app/helpers/tree_helper.rb - About 2 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 nav_link has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def nav_link(options = {}, &block)
                          if path = options.delete(:path)
                            if path.respond_to?(:each)
                              c = path.map { |p| p.split('#').first }
                              a = path.map { |p| p.split('#').last }
                      Severity: Minor
                      Found in app/helpers/tab_helper.rb - About 2 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

                      Class Repository has 23 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Repository
                        include Gitlab::ShellAdapter
                      
                        attr_accessor :raw_repository
                      
                      
                      Severity: Minor
                      Found in app/models/repository.rb - About 2 hrs to fix

                        Class MergeRequestsController has 23 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Projects::MergeRequestsController < Projects::ApplicationController
                          before_filter :module_enabled
                          before_filter :merge_request, only: [:edit, :update, :show, :commits, :diffs, :automerge, :automerge_check, :ci_status]
                          before_filter :closes_issues, only: [:edit, :update, :show, :commits, :diffs]
                          before_filter :validates_merge_request, only: [:show, :diffs]
                        Severity: Minor
                        Found in app/controllers/projects/merge_requests_controller.rb - About 2 hrs to fix

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

                          class WikiPage
                            include ActiveModel::Validations
                            include ActiveModel::Conversion
                            include StaticModel
                            extend ActiveModel::Naming
                          Severity: Minor
                          Found in app/models/wiki_page.rb - About 2 hrs to fix

                            Class Shell has 22 methods (exceeds 20 allowed). Consider refactoring.
                            Open

                              class Shell
                                class AccessDenied < StandardError; end
                            
                                # Init new repository
                                #
                            Severity: Minor
                            Found in lib/gitlab/backend/shell.rb - About 2 hrs to fix

                              Function init has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                init: function(tid, tt, path) {
                                  NoteList.notes_path = path + ".js";
                                  NoteList.target_id = tid;
                                  NoteList.target_type = tt;
                                  NoteList.target_params = "target_type=" + NoteList.target_type + "&target_id=" + NoteList.target_id;
                              Severity: Major
                              Found in app/assets/javascripts/notes.js - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language