Showing 33 of 59 total issues
Function compile
has 203 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function compile(modelDefinition) {
var ARTIFACT = pageService.ARTIFACT; // Easy alias
logger.info('Starting model compile', modelDefinition.name);
Function compile
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
Open
function compile(modelDefinition) {
var ARTIFACT = pageService.ARTIFACT; // Easy alias
logger.info('Starting model compile', modelDefinition.name);
- 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 desktop
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
exports.desktop = function (req, res, appLocals) {
if (!req.user) {
res.redirect('/login');
return;
}
Function buildSteps
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function buildSteps(modelDefinition, todo) {
if (_.isEmpty(modelDefinition.steps)) {
return;
}
Function start
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var start = function () {
var app = express();
app.locals = _.extend(app.locals, config.locals || {});
Function updateData
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function updateData(modelDefinition, row) {
return new BluebirdPromise(function (resolve, reject) {
logger.debug('starting updateData() for ', modelDefinition.name);
checkConnection();
File modelSaver.js
has 259 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
'use strict';
var _ = require('lodash'),
BluebirdPromise = require('bluebird'),
knex = require('knex').knex,
Function mapFields
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function mapFields(modelDefinition) {
if (!modelDefinition.fields) {
logger.warn('Model had no fields');
return;
}
Function getModelByName
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getModelByName(modelName) {
return new BluebirdPromise(function (resolveGetModelByName, rejectGetModelByName) {
logger.debug('starting modelService.getModelByName for ', modelName);
var names = toWhere(modelName);
Function compile
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function compile(menuDefinition) {
logger.info('Starting compile', menuDefinition.name);
var pageNames = [];
Function apply
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function apply(filterString, sql, fields) {
if (!filterString) {
return;
}
Function parseAndCompile
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function parseAndCompile(modelDefinition) {
logger.info('Running parseAndCompile for ' + modelDefinition.name);
//logger.debug(modelDefinition);
var todo = [];
Function queryModelData
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function queryModelData(model) {
return new BluebirdPromise(function (resolve, reject) {
logger.debug('starting queryModelData');
var sql = convertModelToKnexSql(model);
Function convertModelToKnexSql
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function convertModelToKnexSql(model) {
logger.debug('starting convertModelToKnexSql for ' + model.name);
//logger.debug(JSON.stringify(model));
if (!knex) {
Function childUpdate
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function childUpdate(modelDefinition, row, forceDelete) {
return new BluebirdPromise(function (resolve, reject) {
logger.debug('starting childUpdate() for ', modelDefinition.name);
if (!modelDefinition.children) {
Function insertData
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function insertData(modelDefinition, row) {
return new BluebirdPromise(function (resolve, reject) {
logger.debug('starting insertData() for ', modelDefinition.name);
//console.log(row);
Function exports
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (grunt) {
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
Function mapFields
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function mapFields(pageDefinition, modelFields) {
pageDefinition.hasFormView = false;
pageDefinition.hasTableView = false;
pageDefinition.hasNavigation = false;
Function getSqlReadyRow
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var sqlReadyRow = (function getSqlReadyRow() {
function included(field) {
function isDefinedAndFalse(value) {
if (value === undefined) {
return false;
Function addLogins
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function addLogins(app) {
app.get('/logout', function (req, res) {
req.logout();
res.redirect('/');
});