Showing 33 of 59 total issues
Function getDefinition
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getDefinition(artifactType, artifactName) {
//console.log('getDefinition %s %s', artifactType, artifactName);
if (artifactName === undefined) {
throw Error('Failed to get undefined ' + artifactType);
}
Function getArtifactFromSrc
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getArtifactFromSrc(artifactType, moduleName, artifactName) {
return new BluebirdPromise(function (resolve, reject) {
return getRawArtifactFromSrc(artifactType, moduleName, artifactName)
.then(function(jsonData) {
switch (artifactType) {
Function setup
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
var setup = function (custom) {
var defaultConfig = {
/**
* The absolute path to the root of this web server
*/
Function getArtifactFromCache
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getArtifactFromCache(artifactType, moduleName, artifactName) {
// TODO Double check variables for injection
return new BluebirdPromise(function (resolve, reject) {
var file = getArtifactDirectory() + 'dist/' + artifactType + 's/' + artifactName + '.json';
logger.debug('reading file from ' + file);
Function prunePageDefinitionForClient
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.prunePageDefinitionForClient = function (topOriginal) {
function mapModel(original) {
var pruned = {
name: original.name,
fields: _.map(original.fields, function(field) {
Function mergeModelIntoPage
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mergeModelIntoPage(modelDefinition, pageDefinition) {
pageDefinition.model = pageDefinition.model || pageDefinition.name;
pageDefinition.viewMode = pageDefinition.viewMode || 'form';
mapFields(pageDefinition, modelDefinition.fields);
Function columns
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
step.join.columns = _.map(join.columns, function (onClause) {
var fromColumn;
if (onClause.from) {
fromColumn = _.find(fromTable.columns, function (column) {
if (column.name === onClause.from) {
Function deleteData
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function deleteData(modelDefinition, row) {
return new BluebirdPromise(function (resolve, reject) {
// Delete my children first
childUpdate(modelDefinition, row, true)
.then(function () {
Avoid deeply nested control flow statements. Open
if (!fromColumn) {
throw Error('Failed to find from join column ' + onClause.from +
' in table ' + fromTable.name);
}
Function apply
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function apply(filterString, sql, fields) {
if (!filterString) {
return;
}
- 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 deeply nested control flow statements. Open
if (column.name === onClause.from) {
return column;
}
Function desktop
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.desktop = function (req, res, appLocals) {
if (!req.user) {
res.redirect('/login');
return;
}
- 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 mergeModelIntoPage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function mergeModelIntoPage(modelDefinition, pageDefinition) {
pageDefinition.model = pageDefinition.model || pageDefinition.name;
pageDefinition.viewMode = pageDefinition.viewMode || 'form';
mapFields(pageDefinition, modelDefinition.fields);
- 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"