Showing 55 of 97 total issues
Function exports
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(app) {
app.get('/:collection', function (req, res, next) {
var pagination = paginate(req.query);
req.collection.find({}, null, pagination, function (err, docs) {
Function exports
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(app, options) {
// Pretty print json in production as well as development
app.set('json spaces', 2);
// Clean up requests from tools like slumber that set the Content-Type but no body
Function hiddenFields
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function hiddenFields(doc, options) {
var fields = options.hiddenFields || {};
var newDoc = {};
for (var field in doc) {
// Skip any fields that have been hidden on this doc.
- 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 addLinks
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function addLinks(doc, options) {
if (doc.constructor.collection) {
if (options.apiBaseUrl) {
doc.set('url', [
options.apiBaseUrl,
- 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 exports
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(app) {
app.delete('/:collection/:id/image', function (req, res, next) {
var id = req.params.id;
- 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 saveImages
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function saveImages( doc, image, upload, dest_path, idx ) {
Function removeOldMemberships
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function removeOldMemberships(req, memberships, key, id, done) {
Function tidyUpInlineMembershipError
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function tidyUpInlineMembershipError(req, doc, created, updated, callback) {
Function setImage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function setImage(doc, options) {
var images = doc.get('images');
if (!images || images.length === 0) {
return doc;
}
- 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
return;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return;
Function filterDates
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function filterDates(doc, options) {
if (!options.at) {
return doc;
}
- 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 toElasticsearch
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
MembershipSchema.methods.toElasticsearch = function(callback) {
var Person = this.model('Person');
var Organization = this.model('Organization');
var Post = this.model('Post');
var self = this;
- 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 embedPlugin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function embedPlugin(schema) {
/**
* Taked the ?embed parameter and embeds any people, organizations or
* memberships that have been requested.
- 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"