Showing 358 of 358 total issues
Function Modernizr
has 385 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.Modernizr = (function(window,doc,undefined){
var version = '1.5',
ret = {},
Function Modernizr
has a Cognitive Complexity of 89 (exceeds 5 allowed). Consider refactoring. Open
window.Modernizr = (function(window,doc,undefined){
var version = '1.5',
ret = {},
- 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 unserialize_teambox
has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring. Open
def unserialize_teambox(dump, object_maps, opts={})
ActiveRecord::Base.transaction do
@object_map = {
'User' => {},
'Organization' => {}
- 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 metadata_basecamp
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
def metadata_basecamp(with_project_data=false)
firm_members = []
organization_list = ([data['account']['firm']] + data['account']['clients']).map do |firm|
firm_members += firm['people']
- 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
Similar blocks of code found in 2 locations. 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
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 233.
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
Date.parseFormattedString = function (string) {
var regexp = '([0-9]{1,2})/(([0-9]{1,2})/(([0-9]{4})( ([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
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 233.
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 Color
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
YAHOO.util.Color = new function() {
// Adapted from http://www.easyrgb.com/math.html
// hsv values = 0 - 1
// rgb values 0 - 255
- 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 calendar_date_select.js
has 399 lines of code (exceeds 250 allowed). Consider refactoring. Open
// CalendarDateSelect version 1.15 - a prototype based date picker
// Questions, comments, bugs? - see the project page: http://code.google.com/p/calendardateselect
if (typeof Prototype == 'undefined') alert("CalendarDateSelect Error: Prototype could not be found. Please make sure that your application's layout includes prototype.js (.g. <%= javascript_include_tag :defaults %>) *before* it includes calendar_date_select.js (.g. <%= calendar_date_select_includes %>).");
if (Prototype.Version < "1.6") alert("Prototype 1.6.0 is required. If using earlier version of prototype, please use calendar_date_select version 1.8.3");
Method unserialize_teambox
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
def unserialize_teambox(dump, object_maps, opts={})
ActiveRecord::Base.transaction do
@object_map = {
'User' => {},
'Organization' => {}
File modernizr.js
has 387 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*!
* Modernizr JavaScript library 1.5
* http://www.modernizr.com/
*
* Copyright (c) 2009-2010 Faruk Ates - http://farukat.es/
Method metadata_basecamp
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
def metadata_basecamp(with_project_data=false)
firm_members = []
organization_list = ([data['account']['firm']] + data['account']['clients']).map do |firm|
firm_members += firm['people']
Class User
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ActiveRecord::Base
include Immortal
include Metadata
extend Metadata::Defaults
prototype
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
CalendarDateSelect.prototype = {
initialize: function(target_element, options) {
this.target_element = $(target_element); // make sure it's an element, not a string
if (!this.target_element) { alert("Target element " + target_element + " not found!"); return false;}
if (this.target_element.tagName != "INPUT") this.target_element = this.target_element.down("INPUT")
File task_list.js
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
var TaskList = {
in_sort: false,
sortableChange: function(draggable) {
this.currentDraggable = draggable
Method new_slot
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def new_slot(insert_id, insert_before, widget)
PageSlot.transaction do
# Calculate correct position
insert_pos = nil
- 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 Color
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
YAHOO.util.Color = new function() {
// Adapted from http://www.easyrgb.com/math.html
// hsv values = 0 - 1
// rgb values 0 - 255
Method set_page_title
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def set_page_title
location_name = "#{params[:action]}_#{params[:controller]}"
translate_location_name = t("page_title.#{location_name}", :default => '')
if params.has_key?(:id) && ['show_projects','edit_projects'].include?(location_name)
- 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 Task
has 31 methods (exceeds 20 allowed). Consider refactoring. Open
class Task < RoleRecord
include Immortal
include Watchable
Class ApplicationController
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery # See ActionController::RequestForgeryProtection for details
include AuthenticatedSystem
Similar blocks of code found in 2 locations. Consider refactoring. Open
document.on("click", "a.collapsed_mode", function(e,el) {
e.stop();
ActivityFeed.collapseAll();
$$('a.collapsed_mode')[0].up('.el').toggle();
$$('a.expanded_mode')[0].up('.el').toggle();
- 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 107.
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