Showing 244 of 244 total issues
File todos_controller.rb
has 1197 lines of code (exceeds 250 allowed). Consider refactoring. Open
class TodosController < ApplicationController
skip_before_filter :login_required, :only => [:index, :calendar, :tag]
prepend_before_filter :login_or_feed_token_required, :only => [:index, :calendar, :tag]
append_before_filter :find_and_activate_ready, :only => [:index, :list_deferred]
File tracks.js
has 1081 lines of code (exceeds 250 allowed). Consider refactoring. Open
var TracksForm = {
toggle: function(toggleLinkId, formContainerId, formId, hideLinkText,
hideLinkTitle, showLinkText, showLinkTitle) {
var form=$('#'+formContainerId)
form.toggle();
Method create
has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring. Open
def create
@source_view = params['_source_view'] || 'todo'
@default_context = current_user.contexts.where(:name => params['default_context_name']).first
@default_project = current_user.projects.where(:name => params['default_project_name']).first unless params['default_project_name'].blank?
- 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 RecurringTodo
has 80 methods (exceeds 20 allowed). Consider refactoring. Open
class RecurringTodo < ActiveRecord::Base
attr_protected :user
belongs_to :context
belongs_to :project
Method create_multiple
has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring. Open
def create_multiple
if project_specified_by_name(params[:project_name])
project = current_user.projects.where(:name => params[:project_name]).first_or_create
@new_project_created = project.new_record_before_save?
@project_id = project.id
- 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 TodosController
has 62 methods (exceeds 20 allowed). Consider refactoring. Open
class TodosController < ApplicationController
skip_before_filter :login_required, :only => [:index, :calendar, :tag]
prepend_before_filter :login_or_feed_token_required, :only => [:index, :calendar, :tag]
append_before_filter :find_and_activate_ready, :only => [:index, :list_deferred]
File recurring_todo.rb
has 516 lines of code (exceeds 250 allowed). Consider refactoring. Open
class RecurringTodo < ActiveRecord::Base
attr_protected :user
belongs_to :context
belongs_to :project
Method toggle_check
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
def toggle_check
@todo = current_user.todos.find(params['id'])
@source_view = params['_source_view'] || 'todo'
@original_item_due = @todo.due
@original_item_was_deferred = @todo.deferred?
- 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 create
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
def create
if params['exception']
render_failure "Expected post format is valid xml like so: <user><login>username</login><password>abc123</password></user>."
return
end
- 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 run
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
def run(args)
@parser.parse!(args)
# lines = STDIN.read
gtd = API.new
- 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
File stats_controller.rb
has 466 lines of code (exceeds 250 allowed). Consider refactoring. Open
class StatsController < ApplicationController
SECONDS_PER_DAY = 86400;
helper :todos, :projects, :recurring_todos
Method show_empty_message_in_source_container
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def show_empty_message_in_source_container
container_id = ""
source_view do |page|
page.project {
container_id = "p#{@original_item_project_id}empty-nd" if @remaining_in_context == 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
File todos_helper.rb
has 410 lines of code (exceeds 250 allowed). Consider refactoring. Open
module TodosHelper
def remote_star_icon(todo=@todo)
link_to( image_tag_for_star(todo),
toggle_star_todo_path(todo),
Class StatsController
has 43 methods (exceeds 20 allowed). Consider refactoring. Open
class StatsController < ApplicationController
SECONDS_PER_DAY = 86400;
helper :todos, :projects, :recurring_todos
Class Todo
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Todo < ActiveRecord::Base
before_save :render_note
after_save :save_predecessors
Class User
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ActiveRecord::Base
# Virtual attribute for the unencrypted password
attr_accessor :password
attr_protected :is_admin # don't allow mass-assignment for this
Method determine_remaining_in_context_count
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def determine_remaining_in_context_count(context_id = @todo.context_id)
source_view do |from|
from.deferred {
# force reload to todos to get correct count and not a cached one
@remaining_in_context = current_user.contexts.find(context_id).todos.deferred_or_blocked.count
- 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 32 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
protect_from_forgery
include LoginSystem
File todo.rb
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Todo < ActiveRecord::Base
before_save :render_note
after_save :save_predecessors
Method create
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@source_view = params['_source_view'] || 'todo'
@default_context = current_user.contexts.where(:name => params['default_context_name']).first
@default_project = current_user.projects.where(:name => params['default_project_name']).first unless params['default_project_name'].blank?