Showing 5 of 13 total issues
Function set
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
exports.set = function (todo, next) {
const requireId = todoSchema.requiredKeys('id').or('done', 'content');
const err = requireId.validate(todo).error;
let isUpdated = false;
- 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 set
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.set = function (todo, next) {
const requireId = todoSchema.requiredKeys('id').or('done', 'content');
const err = requireId.validate(todo).error;
Function row
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.row = function (filter, next) {
Postgres.connect(this.connectionString, (connErr, client, done) => {
if (connErr) {
Function del
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
exports.del = function (id, next) {
const err = Joi.string().validate(id || null).error;
let isDeleted = false;
- 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 row
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
exports.row = function (filter, next) {
const ids = Object.keys(this.todosDB);
const todos = {
totalTodoCount: ids.length,
- 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"