Showing 368 of 368 total issues
Similar blocks of code found in 3 locations. Consider refactoring. Open
async.series([
function (done) {
//Add "realms" & "capabilities"
daoMng.getRealms(function (err, realms) {
if (err) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 381.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
async.series([
function (done) {
//Add 'realms' & 'capabilities'
daoMng.getRealms(function (err, realms) {
if (err) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 381.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 3 locations. Consider refactoring. Open
async.series([
function (done) {
//Add "realms" & "capabilities"
daoMng.getRealms(function (err, realms) {
if (err) {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 381.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
server.on('after', function (req, res) {
const logInfo = {
request: {
method: req.method,
headers: req.headers,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 239.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
server.on('after', function (req, res) {
const logInfo = {
request: {
method: req.method,
headers: req.headers,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 239.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
File user.js
has 479 lines of code (exceeds 250 allowed). Consider refactoring. 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
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
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
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
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
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
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
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
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
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
module.exports = function (req, res, next) {
if (!req.params.email) {
res.send(400, {
err: 'auth_proxy_error',
des: 'empty email'
Identical blocks of code found in 2 locations. Consider refactoring. Open
tokenMng.createBothTokens(foundUser._id, data, function (err, tokens) {
if (err) {
log.error({err}, 'error creating tokens');
return cbk({
err: err.message,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 102.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
tokenMng.createBothTokens(foundUser._id, data, function (err, tokens) {
if (err) {
log.error({err}, 'error creating tokens');
return cbk({
err: err.message,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 102.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function exports
has 80 lines of code (exceeds 25 allowed). Consider refactoring. 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
'use strict';
const assert = require('assert');
const async = require('async');
const escapeRegexp = require('escape-regexp');