Showing 327 of 327 total issues
Function Portal
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
jobsworth.Portal = (function () {
var $ = jQuery;
function Portal(options) {
this.options = options;
- 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 burnup_extracted_from_show
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def burnup_extracted_from_show
start, step, interval, range, tick = @widget.calculate_start_step_interval_range_tick(tz)
filter = filter_from_filter_by
@items = []
- 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 schedule_extracted_from_show
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def schedule_extracted_from_show
filter = filter_from_filter_by
if @widget.mine?
tasks = current_user.tasks.eager_load(:users, :tags, :sheets, :todos, :dependencies, :dependants, {:project => :customer}, :milestone).where("tasks.completed_at IS NULL AND projects.completed_at IS NULL #{filter} AND (tasks.due_at IS NOT NULL OR tasks.milestone_id IS NOT 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
Method init_rows_and_columns
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def init_rows_and_columns
@total = 0
@row_totals = {}
@column_totals = {}
@column_headers = {}
Function NextTaskPanel
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.tasks.NextTaskPanel = (function ($) {
function NextTaskPanel(options) {
this.options = options;
this.options["popover_placement"] = options["popover_placement"] || "left";
this.el = options.el;
Function handleHeaderClick
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handleHeaderClick(e, args) {
var column = args.column;
if (column.id != gear_column_id) {
return;
}
Method do_column
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def do_column(w, key)
@column_totals[key] += w.duration unless ['comment', '1_start', '2_end', '3_task', '4_note'].include?(key)
rkey = key_from_worklog(w, 15).to_s
row_name = name_from_worklog(w, 1)
Method search
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def search
search_criteria = params[:term].strip
@customers = []
@users = []
- 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 Task
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.Task = (function ($) {
function Task(id) {
this.load(id);
}
Method key_from_worklog
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def key_from_worklog(w, r)
if r == 1
"#{w.customer.name} #{w.project.name} #{w.task.name} #{w.task.task_num}"
elsif r == 2
w.is_a?(Tag) ? w.id : 0
Function bind
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Filter.prototype.bind = function () {
var self = this;
// the user/client search box
$(".search_filter").focus(function () {
Method to_html
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_html
return '' if body.blank?
pres = []
Similar blocks of code found in 2 locations. Consider refactoring. Open
case 'snooze-till-tomorrow':
$('#snooze_until_date span').html(formatDate(tomorrow));
$('#task_hide_until').val(formatDate(tomorrow));
$('#snooze_until_date').show();
$('#show-till-other-task, #customer-reply-label').hide();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 71.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
else {
$("#content_" + response.dom_id).show();
$("#indicator-" + response.dom_id).removeClass("widget-collapsed");
$("#indicator-" + response.dom_id).addClass("widget-open");
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 71.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
case 'snooze-till-next-week':
$('#snooze_until_date span').html(formatDate(next_mon));
$('#task_hide_until').val(formatDate(next_mon));
$('#snooze_until_date').show();
$('#show-till-other-task, #customer-reply-label').hide();
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 71.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (response.collapsed) {
$("#content_" + response.dom_id).hide();
$("#indicator-" + response.dom_id).removeClass("widget-open");
$("#indicator-" + response.dom_id).addClass("widget-collapsed");
}
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 71.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method receive
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def receive(email)
# create wrapper email object
wrapper = Mailman::Email.new(email)
logger.tagged('EMAIL TRACKING') { logger.info 'receive wrapper' }
- 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 range
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def range
return @range if @range
# Swap to an appropriate range based on entries returned
start_date = self.start_date
- 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 milestones_to_select_tag
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def milestones_to_select_tag(milestones)
options = [%Q[<option value="0" title="#{t('forms.select.please_select')}">#{t('forms.select.none')}</option>]] + milestones.collect do |milestone|
date = milestone.due_at.nil? ? t('shared.not_set') : l(milestone.due_at, format: current_user.date_format)
selected = if (@task.milestone_id == milestone.id) || (@task.milestone_id.nil? && milestone.id == '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 init_start_and_end_dates
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def init_start_and_end_dates(params)
range = params[:range].to_i
case range
when 0
# Today
- 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"