Showing 327 of 327 total issues
Function snooze_effects
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
TaskEditor.prototype.snooze_effects = function () {
function formatDate(d) {
return d.getDate() + "/" + (d.getMonth() + 1) + "/" + d.getFullYear();
}
Function bindEvents
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Portal.prototype.bindEvents = function () {
var self = this;
// sortable
$("#widget-container").find(".column").sortable({
Function initialize
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
TaskEditor.prototype.initialize = function () {
var detailContainer = $("#task_details", $(this.el))[0];
this.taskDetailsEditor = new jobsworth.tasks.TaskDetailsEditor({taskId: this.taskId, el: detailContainer});
var notificationContainer = $("#task_notify", $(this.el))[0];
Similar blocks of code found in 2 locations. Consider refactoring. Open
select: function (event, ui) {
var id = ui.item.id;
$(this).val("");
$.get("/tasks/resource/", {resource_id: id}, function (data) {
$("#task_resources").append(data);
- 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 86.
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
select: function (event, ui) {
var id = ui.item.id;
$(this).val("");
$.get("/tasks/dependency/", {dependency_id: id}, function (data) {
$("#task_dependencies .dependencies").append(data);
- 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 86.
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 bind
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function bind() {
var $ = jQuery;
var self = this;
// buttons
Function bind
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Grid.prototype.bind = function () {
var self = this;
$("#groupBy select").change(function () {
var value = $(this).val();
Method update_group
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def update_group(user, group, value, icon = nil)
if group == 'milestone'
val_arr = value.split('/')
task_project = user.projects.find_by(:name => val_arr[0])
if user.can?(task_project, 'milestone')
- 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 ColumnPicker
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
jobsworth.grids.ColumnPicker = (function ($) {
function ColumnPicker(columns, grid, options) {
var $menu;
var columnCheckboxes;
var columnList;
- 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 search_conditions_for
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.search_conditions_for(strings, fields = [:name], options = {})
search_by_id = options.has_key?(:search_by_id) ? options[:search_by_id] : true
id_field= options.has_key?(:table) ? "#{options[:table]}.id" : 'id'
conds = []
- 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 billable
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def billable
@project = current_user.projects.find(params[:project_id]) if params[:project_id]
return render :json => {:billable => false} if @project and @project.no_billing?
return render :json => {:billable => false} if params[:service_id].to_i < 0
return render :json => {:billable => true} if params[:service_id].to_i == 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 do_row
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def do_row(rkey, rname, vkey, duration)
unless @rows[rkey]
@rows[rkey] ||= {}
@row_totals[rkey] ||= 0
@rows[rkey]['__'] = rname
- 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 Planning
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.tasks.Planning = (function ($) {
function Planning() {
this.init();
this.bind();
File feeds_controller.rb
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'rss/maker'
require 'icalendar'
require 'google_chart'
class FeedsController < ApplicationController
Class Project
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Project < ActiveRecord::Base
# Creates a score_rules association and updates the score
# of all the task when adding a new score rule
include Scorable
Class UsersController
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class UsersController < ApplicationController
before_filter :protected_area, :except => [:update_seen_news, :avatar, :auto_complete_for_project_name, :auto_complete_for_user_name]
def index
File grid.js
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
var jobsworth = jobsworth || {};
jobsworth.Grid = (function ($) {
var columns = [
File mailman.rb
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
class Mailman < ActionMailer::Base
# The marker in the email body that shows where the new content ends
BODY_SPLIT = 'o------ please reply above this line ------o'
def self.receive(mail)
Similar blocks of code found in 2 locations. Consider refactoring. Open
function TaskEditor(options) {
this.options = options;
this.taskId = this.options.taskId;
this.el = this.options.el;
this.initialize();
- 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 78.
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
function TaskDetailsEditor(options) {
this.options = options;
this.taskId = this.options.taskId;
this.el = this.options.el;
this.initialize();
- 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 78.
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