Showing 267 of 327 total issues
Function TaskTodosEditor
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.tasks.TaskTodosEditor = (function ($) {
function TaskTodosEditor(options) {
this.options = options;
this.el = this.options.el;
this.initialize();
Function TaskDetailsEditor
has 127 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.tasks.TaskDetailsEditor = (function ($) {
function TaskDetailsEditor(options) {
this.options = options;
this.taskId = this.options.taskId;
this.el = this.options.el;
Function TaskEditor
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
jobsworth.tasks.TaskEditor = (function ($) {
function TaskEditor(options) {
this.options = options;
this.taskId = this.options.taskId;
this.el = this.options.el;
- 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 TasksController
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class TasksController < ApplicationController
DEFAULT_TASK_COUNT = 5
DEFAULT_TASK_NAME = 'New Task'
before_filter :check_if_user_has_projects, :only => [:new, :create]
Method do_column
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def do_column(w, key)
@column_totals[key] += w.duration unless ['comment', '1_start', '2_end', '3_task', '4_note'].include?(key)
rkey = key_from_worklog(w, 15).to_s
row_name = name_from_worklog(w, 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
Method key_from_worklog
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def key_from_worklog(w, r)
if r == 1
"#{w.customer.name} #{w.project.name} #{w.task.name} #{w.task.task_num}"
elsif r == 2
w.is_a?(Tag) ? w.id : 0
- 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 name_from_worklog
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def name_from_worklog(w, r)
if r == 1
"#{w.task.issue_num} <a href=\"/tasks/view/#{w.task.task_num}\">#{ERB::Util.h w.task.name}</a> <br /><small>#{ERB::Util.h w.task.full_name}</small>".html_safe
elsif r == 2
w.is_a?(Tag) ? "#{w.name}" : I18n.t('worklog_reports.status.none')
- 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 TaskFilter
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class TaskFilter < ActiveRecord::Base
# column `name` is of type `VARCHAR(255)`.
# Note that MySQL 5.x+ and PostgreSQL both track length of "characters" and not "bytes"
MAXIMUM_NAME_LENGTH = 255
Function TaskTimer
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.tasks.TaskTimer = (function () {
function bind() {
var $ = jQuery;
var self = this;
Method get_action
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def get_action(log)
if log.task && log.task_id > 0
action = 'Completed' if log.event_log.event_type == EventLog::TASK_COMPLETED
action = 'Reverted' if log.event_log.event_type == EventLog::TASK_REVERTED
action = 'Created' if log.event_log.event_type == EventLog::TASK_CREATED
- 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
Function bindEvents
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
TaskTodosEditor.prototype.bindEvents = function () {
var self = this;
$(this.el).on('click', ".toggle-todo-edit", function () {
self.toggleTodoEdit(this);
Function ColumnPicker
has 97 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.grids.ColumnPicker = (function ($) {
function ColumnPicker(columns, grid, options) {
var $menu;
var columnCheckboxes;
var columnList;
Function ServiceEditor
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.services.ServiceEditor = (function ($) {
function ServiceEditor(options) {
this.options = options;
this.bindEvents();
}
Function ColumnPicker
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ColumnPicker(columns, grid, options) {
var $menu;
var columnCheckboxes;
var columnList;
var gear_icon = '<i title="Select Columns" class="icon-cog pull-right"></i>';
Method search
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
def search
@filter = params[:term]
if @filter.blank?
render :nothing => true
return
Class TaskRecord
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class TaskRecord < AbstractTask
has_many :property_values, :through => :task_property_values
scope :from_this_year, lambda { where('created_at > ?', Time.zone.now.beginning_of_year - 1.month) }
scope :open_only, -> { where(:status => 0) }
File user.rb
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'digest/md5'
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable, :encryptable,
Method update
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.update(task, params, user)
old_tags = task.tags.collect { |t| t.name }.sort.join(', ')
old_deps = task.dependencies.collect { |t| "[#{t.issue_num}] #{t.name}" }.sort.join(', ')
old_owner = task.owners.first
old_users = task.owners.collect { |u| u.id }.sort.join(',')
Method rss
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
def rss
return if params[:id].blank?
headers['Content-Type'] = 'application/rss+xml'
File task_filter.rb
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
class TaskFilter < ActiveRecord::Base
# column `name` is of type `VARCHAR(255)`.
# Note that MySQL 5.x+ and PostgreSQL both track length of "characters" and not "bytes"
MAXIMUM_NAME_LENGTH = 255