Showing 358 of 358 total issues
Function parseFormattedString
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Date.parseFormattedString = function (string) {
var regexp = '([0-9]{4})-(([0-9]{1,2})-(([0-9]{1,2})( ([0-9]{1,2}):([0-9]{2})? *)?)?)?';
var d = string.match(new RegExp(regexp, "i"));
if (d==null) return Date.parse(string); // at least give javascript a crack at it.
var offset = 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
Function detectSelectedSection
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
detectSelectedSection: function() {
// Direct match
var link = $$('.nav_links a').select(function(e) {
return e.getAttribute('href') == window.location.pathname
}).last()
- 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 send_email
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def send_email
return if @is_silent
if invited_user
if belongs_to_organization?
Emailer.send_email :project_membership_notification, self.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 show_threaded_activity
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def show_threaded_activity(activity)
if activity.thread_id.starts_with? "Task_" or activity.thread_id.starts_with? "Conversation_"
mode = %w(projects activities).include?(controller.controller_name) ? "short" : "full"
Rails.cache.fetch("#{mode}-thread/#{activity.thread_id}/#{current_user.locale}") do
render('activities/thread', :activity => activity).to_s
- 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 load_organization
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def load_organization
organization_id ||= params[:id]
if organization_id
@organization = Organization.find_by_id_or_permalink(organization_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 get_action
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_action
if @body =~ ACTION_MATCH
tag = $1.downcase
@target_action = case 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 create_task
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_task
raise "Subject and body cannot be blank when creating task from email" if @subject.blank? && @body.blank?
Rails.logger.info "Creating task '#{@subject}'"
task_list_name = "Inbox"
- 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 cache_comment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def cache_comment(comment, threaded, simpleconv, &block)
cache(comment.cache_key.tap { |key|
key << "-#{comment.user.avatar_updated_at.to_i}-#{comment.project.permalink}"
key << '-threaded' if threaded
key << '-simpleconv' if simpleconv
- 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 setWidgetFormLoading
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
setWidgetFormLoading: function(id, active) {
var form = $(id);
var submit = form ? form.down('.submit') : null;
var loading = form ? form.down('.loading') : 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
Function setProjectFilter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
setProjectFilter: function(id, enabled) {
if (id == 0)
this.filters.project = enabled ? null : []
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
Method task_list_form_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def task_list_form_for(project,task_list,&proc)
raise ArgumentError, "Missing block" unless block_given?
action = task_list.new_record? ? 'new' : 'edit'
- 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_list
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def init_list
unless self.position
self.position = 0
project.task_lists.each do |t|
t.increment!(:position) unless t == self
- 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 initCalendarGrid
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
initCalendarGrid: function() {
var body_div = this.body_div;
this.calendar_day_grid = [];
var days_table = body_div.build("table", { cellPadding: "0px", cellSpacing: "0px", width: "100%" })
// make the weekdays!
- 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 human_hours=
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def human_hours=(duration)
self.hours = if duration.blank?
nil
elsif duration =~ /(\d+)h[ ]*(\d+)m/i
# 2h 15m
- 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 api_scope
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def api_scope
conditions = {}
unless params[:status].nil?
conditions[:status] = Array(params[:status]).map(&:to_i).uniq[0..4]
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
Function sumByHours
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
sumByHours: function(field, map) {
var comments = this.getFilteredComments()
var weekSum = [{},{},{},{},{},{}]
var totalSum = {}
var weekTotal = 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 add_to_rows
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_to_rows(task_list)
# Tries to fit the task_list in the best possible row
unless @expanded
@rows.each do |row|
unless row.detect { |existing_task_list| task_list.overlaps? existing_task_list }
- 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 setUserFilter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
setUserFilter: function(id, enabled) {
if (id == 0)
Hours.filters.user = enabled ? null : []
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
Method to_api_hash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_api_hash(options = {})
base = {
:id => id,
:project_id => project_id,
:user_id => user_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 human_hours
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def human_hours(hours)
hours = (hours.to_f * 100).round.to_f / 100
if hours > 0
minutes = ((hours % 1) * 60).round
- 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"