Showing 267 of 327 total issues
Function ColumnPicker
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
jobsworth.grids.ColumnPicker = (function ($) {
function ColumnPicker(columns, grid, options) {
var $menu;
var columnCheckboxes;
var columnList;
- 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 search_conditions_for
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.search_conditions_for(strings, fields = [:name], options = {})
search_by_id = options.has_key?(:search_by_id) ? options[:search_by_id] : true
id_field= options.has_key?(:table) ? "#{options[:table]}.id" : 'id'
conds = []
- 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 billable
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def billable
@project = current_user.projects.find(params[:project_id]) if params[:project_id]
return render :json => {:billable => false} if @project and @project.no_billing?
return render :json => {:billable => false} if params[:service_id].to_i < 0
return render :json => {:billable => true} if params[:service_id].to_i == 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 do_row
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def do_row(rkey, rname, vkey, duration)
unless @rows[rkey]
@rows[rkey] ||= {}
@row_totals[rkey] ||= 0
@rows[rkey]['__'] = rname
- 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 Planning
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.tasks.Planning = (function ($) {
function Planning() {
this.init();
this.bind();
File feeds_controller.rb
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rss/maker'
require 'icalendar'
require 'google_chart'
class FeedsController < ApplicationController
Class Project
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Project < ActiveRecord::Base
# Creates a score_rules association and updates the score
# of all the task when adding a new score rule
include Scorable
Class UsersController
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class UsersController < ApplicationController
before_filter :protected_area, :except => [:update_seen_news, :avatar, :auto_complete_for_project_name, :auto_complete_for_user_name]
def index
File grid.js
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
var jobsworth = jobsworth || {};
jobsworth.Grid = (function ($) {
var columns = [
File mailman.rb
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Mailman < ActionMailer::Base
# The marker in the email body that shows where the new content ends
BODY_SPLIT = 'o------ please reply above this line ------o'
def self.receive(mail)
Function Portal
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
jobsworth.Portal = (function () {
var $ = jQuery;
function Portal(options) {
this.options = options;
- 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 burnup_extracted_from_show
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def burnup_extracted_from_show
start, step, interval, range, tick = @widget.calculate_start_step_interval_range_tick(tz)
filter = filter_from_filter_by
@items = []
- 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 schedule_extracted_from_show
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def schedule_extracted_from_show
filter = filter_from_filter_by
if @widget.mine?
tasks = current_user.tasks.eager_load(:users, :tags, :sheets, :todos, :dependencies, :dependants, {:project => :customer}, :milestone).where("tasks.completed_at IS NULL AND projects.completed_at IS NULL #{filter} AND (tasks.due_at IS NOT NULL OR tasks.milestone_id IS NOT NULL)")
- 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 init_rows_and_columns
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def init_rows_and_columns
@total = 0
@row_totals = {}
@column_totals = {}
@column_headers = {}
Function NextTaskPanel
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.tasks.NextTaskPanel = (function ($) {
function NextTaskPanel(options) {
this.options = options;
this.options["popover_placement"] = options["popover_placement"] || "left";
this.el = options.el;
Function handleHeaderClick
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handleHeaderClick(e, args) {
var column = args.column;
if (column.id != gear_column_id) {
return;
}
Method do_column
has 48 lines of code (exceeds 25 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)
Method search
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def search
search_criteria = params[:term].strip
@customers = []
@users = []
- 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 Task
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.Task = (function ($) {
function Task(id) {
this.load(id);
}
Method key_from_worklog
has 47 lines of code (exceeds 25 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