Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
1 answer
93 views

Automatically select the table rows between two selected rows

The code is to check the rows in a table. If in a table two non consecutive rows are checked then all the in between rows should be selected by itself. Also, after selecting two rows, on selection of ...
96rashijain's user avatar
3 votes
2 answers
355 views

Descending selection sort in JavaScript

I wrote a simple sort algorithm in JavaScript, but code climate is complaining its complexity being too high (currently sitting on 6 instead of 5, which is code climate wants). I personally cannot ...
Yu Zhang's user avatar
  • 717
3 votes
1 answer
82 views

JavaScript function to categorize data by their "styles" attribute, and store the key-"unicode" pair

I have a JavaScript function to categorize data by their "styles" attribute, and store the key-"unicode" pair. Here's my current code: ...
zypA13510's user avatar
  • 133
8 votes
5 answers
645 views

Checks user level and limit the data before saving it to mongoDB

I have a function that checks user level and limits the data before saving it to mongoDB database (pre 'save' middleware for mongoose). It have been getting complexity warnings and tried to rewrite it,...
Arootin Aghazaryan's user avatar
2 votes
2 answers
85 views

Express.js handler to update user fields

I have an express handler which i thought was pretty simple, but CodeClimate flagged this method as having a Cognitive complexity of 6 (5 is the max by default without flagging something) Curious how ...
Catfish's user avatar
  • 123
3 votes
1 answer
89 views

Adding genres and themes from work

Codacy is telling me this method has a complexity of 13. I need some tips on how to reduce it, more specifically inside the forEach loop. I've already changed it ...
JCRamires's user avatar
1 vote
2 answers
149 views

Reducing code complexity for UsergridClient constructor

I'm initializing a class in JavaScript with a bunch of complex property checks. Codacy is showing that this is bad design and recommends reducing cyclomatic complexity. I'm at a loss for how to ...
brandonscript's user avatar
1 vote
2 answers
214 views

Reducing cyclomatic complexity in a simple string concatenation

I have written the following function that takes an address object and builds a string using the object properties. It will later be used to display a tooltip <...
Simon Adcock's user avatar