Showing 327 of 327 total issues
Method ical
has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring. Open
def ical(mode = :personal)
if params[:id].nil? || params[:id].empty?
render :nothing => true
return
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 TaskEditor
has 296 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.tasks.TaskEditor = (function ($) {
function TaskEditor(options) {
this.options = options;
this.taskId = this.options.taskId;
this.el = this.options.el;
Similar blocks of code found in 2 locations. Consider refactoring. Open
CustomAttributeEdit.prototype.presetChange = function (checkbox) {
checkbox = $(checkbox);
var preset = checkbox.is(":checked");
var parent = checkbox.parents(".attribute");
- 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 254.
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
TaskPropertyEdit.prototype.presetChange = function (checkbox) {
checkbox = $(checkbox);
var preset = checkbox.is(":checked");
var parent = checkbox.parents(".attribute");
- 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 254.
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
Function get_tz_name
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
function get_tz_name() {
var so = -1 * (new Date(Date.UTC(2005, 6, 30, 0, 0, 0, 0))).getTimezoneOffset();
var wo = -1 * (new Date(Date.UTC(2005, 12, 30, 0, 0, 0, 0))).getTimezoneOffset();
if (-660 == so && -660 == wo) return 'Pacific/Midway';
- 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 Grid
has 258 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.Grid = (function ($) {
var columns = [
{
id: 'read',
File abstract_task.rb
has 551 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'active_record_extensions'
# this is abstract class for Task and Template
class AbstractTask < ActiveRecord::Base
self.table_name = 'tasks'
Function Grid
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
jobsworth.Grid = (function ($) {
var columns = [
{
id: 'read',
- 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 rss
has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring. Open
def rss
return if params[:id].blank?
headers['Content-Type'] = 'application/rss+xml'
- 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 54 (exceeds 5 allowed). Consider refactoring. Open
def self.update(task, params, user)
old_tags = task.tags.collect { |t| t.name }.sort.join(', ')
old_deps = task.dependencies.collect { |t| "[#{t.issue_num}] #{t.name}" }.sort.join(', ')
old_owner = task.owners.first
old_users = task.owners.collect { |u| u.id }.sort.join(',')
- 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
Class AbstractTask
has 55 methods (exceeds 20 allowed). Consider refactoring. Open
class AbstractTask < ActiveRecord::Base
self.table_name = 'tasks'
OPEN=0
CLOSED=1
File worklog_report.rb
has 468 lines of code (exceeds 250 allowed). Consider refactoring. Open
class WorklogReport
include ERB::Util
PIVOT = 1
AUDIT = 2
Function Filter
has 176 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.Filter = (function ($) {
function Filter() {
this.init();
this.bind();
}
Similar blocks of code found in 2 locations. Consider refactoring. Open
jQuery(document).ready(function () {
jQuery("#task-filters-collapsable-sidepanel-button").on('click', function () {
if (store.get('task-filters-collapsable-sidepanel-button') == 'h') {
jQuery("#task-filters-collapsable-sidepanel-button").addClass('panel-open');
jQuery("#task-filters-collapsable-sidepanel-button").removeClass('panel-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 175.
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
jQuery(document).ready(function () {
jQuery("#tags-collapsable-sidepanel-button").on('click', function () {
if (store.get('tags-collapsable-sidepanel-button') == 'h') {
jQuery("#tags-collapsable-sidepanel-button").addClass('panel-open');
jQuery("#tags-collapsable-sidepanel-button").removeClass('panel-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 175.
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 render_task_dependants
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def render_task_dependants(t, depth, root_present)
res = ''
@printed_ids ||= []
return if @printed_ids.include? t.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
File tasks_controller.rb
has 443 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'csv'
class TasksController < ApplicationController
DEFAULT_TASK_COUNT = 5
DEFAULT_TASK_NAME = 'New Task'
Function Portal
has 152 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.Portal = (function () {
var $ = jQuery;
function Portal(options) {
this.options = options;
Function TaskNotificationEditor
has 149 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.tasks.TaskNotificationEditor = (function ($) {
function TaskNotificationEditor(options) {
this.options = options;
this.el = this.options.el;
this.initialize();
Method create_csv
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
def create_csv
csv_string = ''
if @column_headers
CSV.generate(csv_string, :col_sep => ',') do |csv|
- 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"