Showing 47 of 93 total issues
Function NumberFilterViewModel
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function NumberFilterViewModel( params ) {
var self = this;
this.operators = [
ops.eq,
Function addBoard
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
self.addBoard = function () {
var board, name = self.newBoardName();
self.boardError( '' );
if ( name === '' ) {
self.boardError( 'Enter new board name' );
Function reloadData
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
self.reloadData = function ( automatic ) {
// FIXME: use some common filter logic
var qs = '$filter=' + self.campaign().getDateFilter() + ' and ' +
'Amount lt \'' + self.majorDonationCutoff() + '\'',
interval = 500000,
Function addJoin
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
function addJoin( table, widget, joins ) {
var i;
if ( table !== widget.mainTableAlias && joins.indexOf( table ) === -1 ) {
if ( widget.optionalJoins[ table ].requires ) {
for ( i = 0; i < widget.optionalJoins[ table ].requires.length; i++ ) {
- 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 saveBoard
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
saveBoard: function ( board ) {
var connection = getConnection(),
insert = 'INSERT INTO dash_board ( owner_id, display_name, description, is_shared ) VALUES ( ?, ?, ?, ? )',
addWidget = 'INSERT INTO dash_widget_instance_board ( instance_id, board_id, widget_position ) SELECT ?, b.id, COALESCE( MAX( widget_position ), 0 ) + 1 FROM dash_board b LEFT JOIN dash_widget_instance_board i ON b.id = i.board_id WHERE b.id = ? AND b.owner_id = ?',
addWidgetParams = [ board.addWidget, board.id, board.ownerId ],
- 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
Avoid too many return
statements within this function. Open
Open
return '';
Avoid too many return
statements within this function. Open
Open
return 0;