Showing 93 of 93 total issues
Function TotalsEarnedChartViewModel
has 354 lines of code (exceeds 25 allowed). Consider refactoring. Open
function TotalsEarnedChartViewModel( params ) {
var self = this,
timeFormat = 'dddd, MMMM Do YYYY, h:mm:ss a',
localUtcOffset = moment().utcOffset();
Function WidgetBase
has 305 lines of code (exceeds 25 allowed). Consider refactoring. Open
function WidgetBase( params ) {
var self = this,
MAX_RETRIES = 3;
Function FraudGaugeViewModel
has 187 lines of code (exceeds 25 allowed). Consider refactoring. Open
function FraudGaugeViewModel( params ) {
WidgetBase.call( this, params );
var self = this,
Function XByYChartViewModel
has 180 lines of code (exceeds 25 allowed). Consider refactoring. Open
function XByYChartViewModel( params ) {
WidgetBase.call( this, params );
var self = this,
wasSaved = self.chartSaved(); // populateChoices() may overwrite
Function exports
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function ( req, res ) {
var widget = widgets[ req.params.widget ],
qs = urlParser.parse( req.url ).query,
parsedQs = querystringParser.parse( qs ),
substitutedQuery,
- 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 totals-earned-chart.js
has 374 lines of code (exceeds 250 allowed). Consider refactoring. Open
define( [
'knockout',
'text!components/widgets/totals-earned-chart/totals-earned-chart.html',
'c3',
'numeraljs',
Function buildWhere
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
function buildWhere( filterNode, widget, values, joins ) {
var col, colText, op, rightClause, leftClause, val, i, pattern, partial, ops = {
and: 'AND',
or: 'OR',
eq: '=',
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
require( 'fs' ).readdirSync( __dirname )
.filter( function ( file ) {
return ( ( file.indexOf( '.' ) !== 0 ) && ( file !== 'index.js' ) && ( file.slice( -3 ) === '.js' ) );
} )
.forEach( function ( file ) {
- 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 129.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
require( 'fs' ).readdirSync( __dirname )
.filter( function ( file ) {
return ( ( file.indexOf( '.' ) !== 0 ) && ( file !== 'index.js' ) && ( file.slice( -3 ) === '.js' ) );
} )
.forEach( function ( file ) {
- 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 129.
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 ABTestingViewModel
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
var ABTestingViewModel = function ( params ) {
var self = this;
self.title = 'A/B Test Results';
Function processData
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
self.processData = function ( rawdata, timescale, grouping, timestamp ) {
var timeWord = ( timescale === 'Day' ? 'Dai' : timescale ) + 'ly',
totals,
counts,
Function AppContent
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
function AppContent() {
var self = this,
pages = [ 'Library', 'Profile', 'Home' ];
hasher.prependHash = '';
Function exports
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function ( req, res ) {
var widget = widgets[ req.params.widget ],
qs = urlParser.parse( req.url ).query,
parsedQs = querystringParser.parse( qs ),
substitutedQuery,
Similar blocks of code found in 2 locations. Consider refactoring. Open
addWidget: function ( req, res ) {
var board = {
ownerId: req.session.passport.user.localId,
id: req.params.id,
addWidget: req.body.instanceId
- 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 117.
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
deleteWidget: function ( req, res ) {
var board = {
ownerId: req.session.passport.user.localId,
id: req.params.id,
deleteWidget: req.params.instanceId
- 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 117.
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 AmtPerSecondChartViewModel
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
function AmtPerSecondChartViewModel( params ) {
var self = this;
WidgetBase.call( this, params );
self.hasData = ko.observable( false );
File widgetBase.js
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
define( [
'jquery',
'knockout',
'operators'
], function ( $, ko, ops ) {
Similar blocks of code found in 2 locations. Consider refactoring. Open
Currency: {
table: 'pi',
column: 'currency_code',
display: 'Currency',
type: 'dropdown',
- 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 108.
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
Currency: {
table: 'cx',
column: 'original_currency',
display: 'Currency',
type: 'dropdown',
- 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 108.
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 buildWhere
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
function buildWhere( filterNode, widget, values, joins ) {
var col, colText, op, rightClause, leftClause, val, i, pattern, partial, ops = {
and: 'AND',
or: 'OR',
eq: '=',