Showing 51 of 96 total issues
Function sendMail
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function sendMail (opts) {
var toEmail = opts.toEmail
, body = opts.body
, fromEmail = opts.fromEmail
, fromName = opts.fromName
Function attach
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Database.prototype.attach = function (name, filePaths) {
var self = this
, doc = (typeof name === 'string' ? this.get(name) : Promise.resolve([name]));
if (filePaths.length === 0) {
Function validate
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
UserCollection.prototype.validate = function (user) {
var services = ['password', 'facebook', 'twitter']
, identifiers = ['email', 'facebookId', 'twitterId', 'username']
, userIdentifiers = [];
- 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) {
return app.collection({
name: 'Post',
isPostType: true,
timestamps: true,
- 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 search
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Collection.prototype.search = function (opts, filtered) {
/*
Only supports ElasticSearch since
that's what apps currently in
production were using before the
- 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 send
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Mailer.prototype.send = function (templateName, toUser, withData, fromEmail, fromName) {
Function savePost
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function savePost (req, _, Post, app, uuid){
Function save
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Item.prototype.save = function () {
var self = this
, fields = this._collection.fields
, uploadFields
, attachmentPaths;
- 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 doSearch({
index: collection.name,
type: collection.name,
body: {query: esQuery}
});
Function exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (app) {
return app.collection({
name: 'Page',
isPostType: true,
timestamps: true,
- 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 follow
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Collection.prototype.follow = function (opts, handler) {
var opts = opts || {}
, args = {}
, handler = handler || function(){}
, feed;
- 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"