Showing 367 of 1,006 total issues
Function validateVal
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
function validateVal(val, schema) {
if (schema === String) return `${val}`;
if (schema === Number) {
val = parseFloat(schema);
return isNaN(val) ? 0 : val;
- 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 authenticate
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
UserSchema.statics.authenticate = function (email, password, callback) {
// Has ad config
if (config_1.default.ldap) {
this.loginByActiveDirectory(email, password, (err, adUser) => {
console.log(`Active directory login msg: ${err}, User info`, adUser);
Function humaneDate
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.humaneDate = function humaneDate(date, compareTo) {
if (!date) {
return;
}
const lang = {
Function humaneDate
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.humaneDate = function humaneDate(date, compareTo) {
if (!date) {
return;
}
Function projectPlugin
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
function projectPlugin(req, res, next) {
let pluginid;
// if only 3 args, then get pluginid from params ":plugin"
if (arguments.length === 4) {
pluginid = req;
Function exports
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function ($http, $timeout) {
this.idle = true;
this.status = 'idle';
this.loadPlugin = function (id) {
Function exports
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function () {
this.busy = false;
this.hasUpgrades = (function () {
for (var name in plugins) {
File tests.js
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
define("strider-ui/tests/in-run-loop.d", [], function () {
"use strict";
});
Function prepareJob
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
function prepareJob(emitter, job) {
Project.findOne({ name: job.project })
.populate('creator')
.exec(function (err, project) {
if (err || !project)
File repo.js
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Repo-specific actions - such as deactivation, deletion etc.
* routes/api/repo.js
*/
Function CollaboratorsController
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function CollaboratorsController($scope) {
$scope.new_email = '';
$scope.new_access = 0;
$scope.collaborators = global.collaborators || [];
$scope.remove = function (item) {
- 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 _copyAndTrimNpmrcFile
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function _copyAndTrimNpmrcFile(sourceNpmrcPath, targetNpmrcPath) {
console.log(`Copying ${sourceNpmrcPath} --> ${targetNpmrcPath}`); // Verbose
let npmrcFileLines = fs.readFileSync(sourceNpmrcPath).toString().split('\n');
npmrcFileLines = npmrcFileLines.map((line) => (line || '').trim());
const resultLines = [];
- 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 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function ($scope, $sce) {
$scope.message = null;
$scope.error = function (text, digest) {
$scope.message = {
File backchannel.js
has 266 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* Backchannel server allows workers to stream messages back to the Node server
* in a line-buffered way. Uses SSL.
*/
const _ = require('lodash');
Function projectPlugin
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function projectPlugin(req, res, next) {
let pluginid;
// if only 3 args, then get pluginid from params ":plugin"
if (arguments.length === 4) {
pluginid = req;
Function registerWithInvite
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
UserSchema.statics.registerWithInvite = function (
inviteCode: string,
email: string,
password: string,
cb: Function
Function CollaboratorsController
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function CollaboratorsController($scope) {
$scope.new_email = '';
$scope.new_access = 0;
$scope.collaborators = global.collaborators || [];
$scope.remove = function (item) {
Function exports
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (pluginsPath) {
const localPlugins = require('./local_plugins')(pluginsPath);
var pluginsPath = localPlugins.path();
prompt.message = 'plugin';
prompt.start();
Function processAndRender
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
}, function processAndRender(err, resultsDetail, results) {
if (err)
throw err;
results.forEach(function (job) {
job.duration = Math.round((job.finished_timestamp - job.created_timestamp) / 1000);
Function DeactivateController
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function DeactivateController($scope) {
var message = 'This will remove all configuration and history for this project. You can always re-add it on the /projects page';
$scope.active = $scope.panelData.deactivate;
$scope.loading = false;
$scope.toggleActive = function () {
- 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"