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,
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
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")
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,
Method each
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def each
line_old = 1
line_new = 1
type = nil
- Read upRead up
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"
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
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
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
- Read upRead up
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
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,
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]
- Read upRead up
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,
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 }
- Read upRead up
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 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("\/")
- Read upRead up
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 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]
Class Repository
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Repository
include Gitlab::ShellAdapter
attr_accessor :raw_repository
Class WikiPage
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class WikiPage
include ActiveModel::Validations
include ActiveModel::Conversion
include StaticModel
extend ActiveModel::Naming
Class Shell
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Shell
class AccessDenied < StandardError; end
# Init new repository
#
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;