Showing 6 of 6 total issues
Function createPersonRecord
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
F1Register.prototype.createPersonRecord = function (reg, callback) {
this.getStatus(NEW_STATUS, function (err, status) {
if (err) return callback(err)
this.createHousehold(reg, function (err, householdResponse) {
- Read upRead up
- Create a ticketCreate a ticket
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 translate
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
WufooTranslator.prototype.translate = function (postBody, callback) {
process.nextTick(function () {
if (validBody(postBody)) {
debug('translating %j', postBody)
var struct = JSON.parse(postBody.FieldStructure)
- Create a ticketCreate a ticket
Function handler
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Hooks.prototype.handler = function (req, res, next) {
this.validateBody(req.body, function valid (err) {
if (typeof (err) === 'string') return res.status(400).send(err)
if (typeof (err) === 'number') return res.status(err).end()
- Read upRead up
- Create a ticketCreate a ticket
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 _createComm
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
F1Register.prototype._createComm = function (generalCommName, commName, person, reg, callback) {
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return callback()
- Create a ticketCreate a ticket
Function validateBody
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Hooks.prototype.validateBody = function (body, callback) {
if (!body) {
debug('missing body (%j)', body)
return callback('missing body')
} else if (!body.FieldStructure) {
- Read upRead up
- Create a ticketCreate a ticket
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"