Showing 12 of 59 total issues
File userRepository.spec.js
has 664 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
var expect = require('expect.js');
var userRepo = require('../../../repositories/UserRepository');
var bcrypt = require('bcrypt-nodejs');
File api.js
has 532 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
"use strict";
//global requires
var secrets = require('../config/secrets');
var querystring = require('querystring');
Function exports
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(db, DataTypes) {
var User = db.define('User', {
id: {
type: DataTypes.INTEGER,
autoIncrement: true,
File UserRepository.js
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
var db = require('../models/sequelize');
var PSW_RESET_TOKEN_VALID_FOR = 3; //hours
Function getLastfm
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.getLastfm = function(req, res, next) {
LastFmNode = require('lastfm').LastFmNode;
var lastfm = new LastFmNode(secrets.lastfm);
async.parallel({
Function getSteam
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.getSteam = function(req, res, next) {
var steamId = '76561198040657099';
var query = { l: 'english', steamid: steamId, key: secrets.steam.apiKey };
async.parallel({
playerAchievements: function(done) {
Function getPayPal
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.getPayPal = function(req, res, next) {
paypal = require('paypal-rest-sdk');
paypal.configure({
mode: 'sandbox',
Function postForgot
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.postForgot = function(req, res, next) {
crypto = require('crypto');
req.assert('email', 'Please enter a valid email address.').isEmail();
var errors = req.validationErrors();
Function getBitGo
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.getBitGo = function(req, res, next) {
BitGo = require('bitgo');
var bitgo = new BitGo.BitGo({ env: 'test', accessToken: secrets.bitgo.accessToken });
var walletId = req.session.walletId; // we use the session to store the walletid, but you should store it elsewhere
Function postVenmo
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.postVenmo = function(req, res, next) {
req.assert('user', 'Phone, Email or Venmo User ID cannot be blank').notEmpty();
req.assert('note', 'Please enter a message to accompany the payment').notEmpty();
req.assert('amount', 'The amount you want to pay cannot be blank').notEmpty();
var errors = req.validationErrors();
Function postReset
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.postReset = function(req, res, next) {
req.assert('password', 'Password must be at least 4 characters long.').len(4);
req.assert('confirm', 'Passwords must match.').equals(req.body.password);
var errors = req.validationErrors();
Function exports
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function(db, DataTypes) {
var User = db.define('User', {
id: {
type: DataTypes.INTEGER,
autoIncrement: 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"