Showing 51 of 368 total issues
File user.js
has 479 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
const request = require('request');
const _ = require('lodash');
const ciphertoken = require('ciphertoken');
Function salesforceCallback
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function salesforceCallback(req, res, next) {
const sfData = req.user;
const profile = sfData.profile;
daoMng.getFromUsername(profile._raw.email, function (err, foundUser) {
Function createUserPrivateCall
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createUserPrivateCall(body, user, cbk) {
const clonedBody = _.clone(body);
delete clonedBody.password;
const options = {
url: `http://${_settings.private_host}:${_settings.private_port}${_settings.passThroughEndpoint.path}`,
Function exports
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function () {
service.start = function (publicPort, done) {
server = restify.createServer({
name: 'cipherlayer-server',
Function createUserByToken
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createUserByToken(token, cbk) {
if (!token) {
return cbk({
err: 'auth_proxy_error',
des: 'empty param verifyToken',
Function postAuthRegisterFacebook
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function postAuthRegisterFacebook(req, res, next) {
const options = _.clone(defaultOptions);
options.qs.access_token = req.body.accessToken;
Function start
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
service.start = function (publicPort, done) {
server = restify.createServer({
name: 'cipherlayer-server',
log
});
Function createUser
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function createUser(body, pin, cbk) {
if (!body[_settings.passThroughEndpoint.username]) {
return cbk({
err: 'auth_proxy_error',
des: 'invalid userinfo',
Function exports
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (req, res, next) {
const refreshToken = req.body.refreshToken;
const data = {};
if (req.body.deviceId) {
Function verifyPhone
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function verifyPhone(redisKeyId, phone, country, pin, cbk) {
if (!_settings.phoneVerification) {
return cbk(null, true);
}
Function exports
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (req, res, next) {
if (!req.params.email) {
res.send(400, {
err: 'auth_proxy_error',
des: 'empty email'
Function exports
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (req, res, next) {
const userAgent = String(req.headers['user-agent']);
cryptoMng.encrypt(req.body.password, function (encryptedPwd) {
daoMng.getFromUsernamePassword(req.body.username, encryptedPwd, function (err, foundUser) {
File dao.js
has 291 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
const assert = require('assert');
const async = require('async');
const escapeRegexp = require('escape-regexp');
File salesforce.js
has 285 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
const log = require('../logger/service');
const request = require('request');
const async = require('async');
Function pinValidation
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function pinValidation(req, res, next) {
if (!_settings.phoneVerification || !_settings.phoneVerification.pinValidationEndpoints) {
return next();
}
Function prepareOptions
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
Open
function prepareOptions(req, res, next) {
const options = {
url: `http://${config.private_host}:${config.private_port}${req.url}`,
headers: {
- 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 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function () {
const service = {};
let server;
service.start = function (internalPort, done) {
Function exports
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (req, res, next) {
if (!req.params) {
res.send(400, {
err: 'invalid_url_params',
des: 'The call to this url must have params.'
Function propagateRequest
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function propagateRequest(req, res, next) {
const start = Date.now();
const useDirectProxy = _.some(config.directProxyUrls, function (pattern) {
return req.url.match(new RegExp(pattern, 'g'));
Function checkPermissions
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function checkPermissions(req, res, next) {
if (!config.endpoints) {
return next();
}
- 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"