Showing 64 of 1,614 total issues
File todos_controller.rb
has 1067 lines of code (exceeds 300 allowed). Consider refactoring. Open
class TodosController < ApplicationController
skip_before_action :login_required, :only => [:index, :tag, :list_deferred, :show, :list_hidden, :done]
prepend_before_action :login_or_feed_token_required, :only => [:index, :tag, :list_deferred, :show, :list_hidden, :done]
append_before_action :find_and_activate_ready, :only => [:index, :list_deferred]
Class TodosController
has 70 methods (exceeds 20 allowed). Consider refactoring. Open
class TodosController < ApplicationController
skip_before_action :login_required, :only => [:index, :tag, :list_deferred, :show, :list_hidden, :done]
prepend_before_action :login_or_feed_token_required, :only => [:index, :tag, :list_deferred, :show, :list_hidden, :done]
append_before_action :find_and_activate_ready, :only => [:index, :list_deferred]
File todos_helper.rb
has 559 lines of code (exceeds 300 allowed). Consider refactoring. Open
require 'staleness'
module TodosHelper
# === helpers for rendering container
def empty_message_holder(container_name, show, title_param = nil)
Class Actions
has 41 methods (exceeds 20 allowed). Consider refactoring. Open
class Actions
SECONDS_PER_DAY = 86_400
attr_reader :user
Class Todo
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class Todo < ApplicationRecord
MAX_DESCRIPTION_LENGTH = 300
MAX_NOTES_LENGTH = 60_000
after_save :save_predecessors
Class ApplicationController
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
Class AbstractRecurrencePattern
has 33 methods (exceeds 20 allowed). Consider refactoring. Open
class AbstractRecurrencePattern
attr_accessor :attributes
def initialize(user)
@user = user
Class User
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ApplicationRecord
# Virtual attribute for the unencrypted password
attr_accessor :password
cattr_accessor :per_page
Class TodoCreateParamsHelper
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class TodoCreateParamsHelper
attr_reader :new_project_created, :new_context_created, :attributes
def initialize(params, user)
set_params(params)
Method create
has a Cognitive Complexity of 64 (exceeds 50 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 if params['default_project_name'].present?
- 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
Consider simplifying this complex logical expression. Open
if source_view_is_one_of(:tag, :context, :project)
return @remaining_in_context == 0 && (
todo_moved_out_of_container ||
(@todo_hidden_state_changed && @todo.hidden?) ||
@todo_was_deferred_from_active_state ||
Class AbstractRecurringTodosBuilder
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class AbstractRecurringTodosBuilder
attr_reader :mapped_attributes, :pattern
def initialize(user, attributes, pattern_class)
@user = user
Class AttributeHandler
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class AttributeHandler
attr_reader :attributes
def initialize(user, attributes)
@user = user
File projects_controller.rb
has 304 lines of code (exceeds 300 allowed). Consider refactoring. Open
class ProjectsController < ApplicationController
helper :application, :todos, :notes
before_action :set_source_view
before_action :set_project_from_params, :only => [:update, :destroy, :show, :edit, :set_reviewed]
before_action :default_context_filter, :only => [:create, :update]
File todo.rb
has 304 lines of code (exceeds 300 allowed). Consider refactoring. Open
class Todo < ApplicationRecord
MAX_DESCRIPTION_LENGTH = 300
MAX_NOTES_LENGTH = 60_000
after_save :save_predecessors
File actions.rb
has 301 lines of code (exceeds 300 allowed). Consider refactoring. Open
module Stats
class Actions
SECONDS_PER_DAY = 86_400
attr_reader :user
Method create_multiple
has a Cognitive Complexity of 59 (exceeds 50 allowed). Consider refactoring. Open
def create_multiple
p = Todos::TodoCreateParamsHelper.new(params, current_user)
tag_list = p.tag_list
@not_done_todos = []
- 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 toggle_check
has a Cognitive Complexity of 53 (exceeds 50 allowed). Consider refactoring. Open
def toggle_check
@todo = current_user.todos.find(params['id'])
@source_view = params['_source_view'] || 'todo'
- 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
Consider simplifying this complex logical expression. Open
container_id = "hidden_container-empty-d" if (@remaining_hidden_count == 0 && !@todo.hidden? && @todo_hidden_state_changed) ||
(@remaining_hidden_count == 0 && @todo.completed? && @original_item.hidden?)
Consider simplifying this complex logical expression. Open
container_id = "deferred_pending_container-empty-d" if (todo_was_removed_from_deferred_or_blocked_container && @remaining_deferred_or_pending_count == 0) ||
(@original_item.deferred? && @remaining_deferred_or_pending_count == 0 && (@todo.completed? || @tag_was_removed))