Showing 49 of 160 total issues
Function default
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function(ComposedComponent) {
class AuthenticationForCounsellor extends Component {
static contextTypes = {
router: React.PropTypes.object
};
Function render
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<div className="message-box" id="message-box">
{this.props.msgs.map(
({
Consider simplifying this complex logical expression. Open
if (
!username ||
!nickname ||
!age ||
!gender ||
Consider simplifying this complex logical expression. Open
if (
!nickname ||
!age ||
!gender ||
!email ||
Function process
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.process = function(values) {
return new Promise(function(resolve, reject) {
if (values.password) {
bcrypt.hash(values.password, SALT_ROUNDS, function(err, hash) {
if (err) {
- 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 abstractSignup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function abstractSignup(user, requiredCredentials, role, res, model) {
var error = false;
var missingCredentials = [];
Object.keys(requiredCredentials).forEach(function (property) {
- 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 updateAccount
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.updateAccount = async function (role, model, user, id, req, res) {
Function changePassword
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exports.changePassword = async function (req, res, model) {
var id = req.query.ID;
var oldPassword = req.body.oldPassword;
let err, oldPasswordHashed, newPasswordHashed, users, isMatch;
- 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 abstractSignup
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
async function abstractSignup(user, requiredCredentials, role, res, model) {
Function abstractJwtLogin
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function abstractJwtLogin(payload, done, role, model) {
// lookup user by user id from payload subject
// and return the user object if found
// or false if not found
var err, users;
- 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 fieldQueries
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function fieldQueries(fields, and) {
var query = '';
for (var j=0; j<fields.length; j++) {
query += ' '+fields[j]+'=?';
if (j!=fields.length-1) {
- 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 fields;
Avoid too many return
statements within this function. Open
return res.status(201).send({
success: "Survey successfully submitted.",
userid: results.insertId
});
Avoid too many return
statements within this function. Open
return res.status(201).send({success: "Successfully changed password."});
Avoid too many return
statements within this function. Open
return res.status(422).send({error: "Failed to change password."});
Avoid too many return
statements within this function. Open
return res.status(201).send({success: "Successfully added or updated twilio account information."});
Avoid too many return
statements within this function. Open
return res.status(422).send({error: "Failed to encrypt password."});
Avoid too many return
statements within this function. Open
return res.status(422).send({error: "Database "+role+" update error."});
Avoid too many return
statements within this function. Open
return res.status(422).send({error: "Failed to encrypt password."});
Avoid too many return
statements within this function. Open
return res.status(422).send({error: "Failed to change password."});