Showing 182 of 244 total issues
Consider simplifying this complex logical expression. Open
container_id = "tickler-empty-nd" if (todo_was_removed_from_deferred_or_blocked_container && @remaining_deferred_or_pending_count == 0) ||
(@original_item_was_deferred && @remaining_deferred_or_pending_count == 0 && (@todo.completed? || @tag_was_removed))
Method update_due_and_show_from_dates
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_due_and_show_from_dates
if params["todo"].has_key?("due")
begin
params["todo"]["due"] = parse_date_per_user_prefs(params["todo"]["due"])
rescue
- 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 clearForm
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
$.fn.clearForm = function() {
return this.each(function() {
var type = this.type, tag = this.tagName.toLowerCase();
if (tag == 'form')
return $(':input',this).clearForm();
- 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 tag
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def tag
get_params_for_tag_view
@page_title = t('todos.tagged_page_title', :tag_name => @tag_title)
@source_view = params['_source_view'] || 'tag'
- 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_dependency_state
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_dependency_state
# assumes @todo.save was called so that the predecessor_list is persistent
if @original_item_predecessor_list != params[:predecessor_list]
# Possible state change with new dependencies
if @todo.uncompleted_predecessors.empty?
- 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 askIfNewContextProvided
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
askIfNewContextProvided: function(source, element_to_block) {
var givenContextName = $('#'+source+'todo_context_name').val();
if (givenContextName.length == 0) return true; // do nothing and depend on rails validation error
var contexts = TodoItems.getContextsForAutocomplete(givenContextName, element_to_block);
- 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 new
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def new
@auth_types = []
unless session[:cas_user]
Tracks::Config.auth_schemes.each {|auth| @auth_types << [auth,auth]}
else
- 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
Avoid too many return
statements within this method. Open
page.todo { return @context_changed || @todo.hidden? || @todo.deferred? || @todo.pending?}
Avoid too many return
statements within this method. Open
return "c#{todo.context_id}empty-nd"
Avoid too many return
statements within this method. Open
return (@todo.active? && @todo.project && @todo.project.id == @default_project.id) ||
(@todo.project.hidden? && @todo.project_hidden?) ||
( @todo.deferred? && (@todo.project.id == @default_project.id) ) ||
@todo.pending?
Avoid too many return
statements within this method. Open
return "c#{todo.context_id}empty-nd"
Avoid too many return
statements within this method. Open
return true
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return "empty_#{@new_due_id}"
Avoid too many return
statements within this method. Open
return
Avoid too many return
statements within this method. Open
page.stats { return @todo.completed? }
Avoid too many return
statements within this method. Open
return "tickler-empty-nd" if
Avoid too many return
statements within this method. Open
return
Avoid too many return
statements within this method. Open
return "c#{todo.context_id}empty-nd"
Avoid too many return
statements within this method. Open
return false if params[:user][:password].empty?