Showing 182 of 244 total issues
Method postTodo
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def postTodo(l, options = {})
uri = URI.parse(GTD_URI_TODOS)
http = Net::HTTP.new(uri.host, uri.port)
if uri.scheme == "https" # enable SSL/TLS
- 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 projects_controller.rb
has 309 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ProjectsController < ApplicationController
helper :application, :todos, :notes
before_filter :set_source_view
before_filter :set_project_from_params, :only => [:update, :destroy, :show, :edit, :set_reviewed]
Method from_rich_message
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def self.from_rich_message(user, default_context_id, description, notes)
fields = description.match(/([^>@]*)@?([^>]*)>?(.*)/)
description = fields[1].strip
context = fields[2].strip
project = fields[3].strip
- 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 update
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def update
params['context'] ||= {}
success_text = if params['field'] == 'name' && params['value']
params['context']['id'] = params['id']
params['context']['name'] = params['value']
- 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_multiple
has 77 lines of code (exceeds 25 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
Method yaml_import
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
def yaml_import
@errmessage = ''
@inarray = YAML::load(params['import']['yaml'])
# arrays to handle id translations
Function setup_behavior
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
setup_behavior: function() {
/* add new recurring todo plus-button in sidebar */
$(document).on("click","#add-new-recurring-todo", function(){
$( "#new-recurring-todo" ).dialog( "open" );
});
Method run
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(args)
@parser.parse!(args)
# lines = STDIN.read
gtd = API.new
Method destroy
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def destroy
@source_view = params['_source_view'] || 'todo'
@todo = current_user.todos.find(params['id'])
@original_item_due = @todo.due
@context_id = @todo.context_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
Method project_and_context_links
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def project_and_context_links(todo, parent_container_type, opts = {})
str = ''
if todo.completed?
str += todo.context.name unless opts[:suppress_context]
should_suppress_project = opts[:suppress_project] || todo.project.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
Method update
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def update
template = ""
params['project'] ||= {}
if params['project']['state']
- 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 included
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(klass)
klass.class_eval do
# Add tags associations
has_many :taggings, :as => :taggable
Method check_for_next_todo
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def check_for_next_todo(todo)
# check if this todo has a related recurring_todo. If so, create next todo
new_recurring_todo = nil
recurring_todo = nil
if todo.from_recurring_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
Method update
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def update
@todo = current_user.todos.find(params['id'])
@source_view = params['_source_view'] || 'todo'
# init_data_for_sidebar unless mobile?
- 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 63 lines of code (exceeds 25 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
Method toggle_check
has 61 lines of code (exceeds 25 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?
Method due_date
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def due_date(due)
return "" if due.nil?
days = days_from_today(due)
- 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 _add_tags
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _add_tags incoming
tag_cast_to_string(incoming).each do |tag_name|
# added following check to prevent empty tags from being saved (which will fail)
unless tag_name.blank?
begin
- 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 setup_behavior
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
setup_behavior: function() {
/* in-place edit of project name */
$('div#project_name').editable(ProjectListPage.save_project_name, {
style: 'padding: 0px; width=100%;',
submit: i18n['common.ok'],
Consider simplifying this complex logical expression. Open
return (@remaining_in_context == 0 && (@todo_hidden_state_changed && @todo.hidden?)) ||
(@remaining_in_context == 0 && @todo_was_deferred_from_active_state) ||
(@remaining_in_context == 0 && @tag_was_removed) ||
(@remaining_in_context == 0 && @todo.completed? && !(@original_item_was_deferred || @original_item_was_hidden)) if source_view_is(:tag)