Showing 29 of 42 total issues
File view.js
has 351 lines of code (exceeds 250 allowed). Consider refactoring. Open
var fs = require('fs');
var logger = require('jslogging');
var async = require('async');
var compressor = require('node-minify');
Function handleRequest
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
function handleRequest (req, res, rootDirectory, htmlFiles, callback) {
logger.debug('req.url: ' + req.url);
// Parse the request url
var URI = req.url.substring(1, req.url.length);
logger.log('Requested URI is: ' + URI, 7);
- 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 generateSupportFilesForDeploy
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
View.prototype.generateSupportFilesForDeploy = function(type, minify, callback) {
var viewHandle = this;
if(typeof(this.includes) === 'undefined') {
throw new Error('Includes was undefined');
- 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 handleRequest
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
function handleRequest (req, res, rootDirectory, htmlFiles, callback) {
logger.debug('req.url: ' + req.url);
// Parse the request url
var URI = req.url.substring(1, req.url.length);
logger.log('Requested URI is: ' + URI, 7);
Function create
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
View.prototype.create = function(callback) {
var viewname = this.name;
if(typeof(this.name) === 'undefined' || this.name === '') {
throw new Error('No view name, did you call view.init with a 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 create
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
View.prototype.create = function(callback) {
var viewname = this.name;
if(typeof(this.name) === 'undefined' || this.name === '') {
throw new Error('No view name, did you call view.init with a name?');
}
Function generateSupportFilesForDeploy
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
View.prototype.generateSupportFilesForDeploy = function(type, minify, callback) {
var viewHandle = this;
if(typeof(this.includes) === 'undefined') {
throw new Error('Includes was undefined');
Function init
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
LibraryManager.prototype.init = function() {
//debugger;
if(typeof(this.includes) === 'undefined') {
this.includes = [];
Function exports
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (args, settings) {
var nm = require('./nirodhaManager.js');
nm.setSettings(settings);
var rootDirectory;
Function insertLibrariesAt
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function insertLibrariesAt(text, libobject, callback) {
// logger.log('text dump: ' + JSON.stringify(text));
logger.debug('libobject dump: ' + JSON.stringify(libobject));
var start = text.indexOf(libobject.title);
Function parse
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parse(res, directory, view, callback) {
/*
* Parse the libraries included in the thtml
*/
logger.debug('Directory: ' + directory);
Function _deploy
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
NirodhaManager.prototype._deploy = function(minify, settings, viewname, callback) {
var views = [];
if(typeof(viewname) === 'undefined') {
logger.debug('No viewname specified!');
Function MinifyFile
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
MinifyFile: function(cb) {
var include;
var includeTitle;
var inPath;
Function exports
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (args, settings, callback) {
logger.debug('Entering create...', 6);
logger.debug('Args: ' + JSON.stringify(args));
logger.debug('Settings: ' + JSON.stringify(settings));
- 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 serveLibrary
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
LibraryManager.prototype.serveLibrary = function(uri, res, callback) {
var type = uri.indexOf('js') > 0 ? 'js' : 'css';
getLibraryContents(uri, function(pageText, found) {
if(found) {
if(type === 'js') {
Function exports
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (args, settings, callback) {
logger.debug('Entering create...', 6);
logger.debug('Args: ' + JSON.stringify(args));
logger.debug('Settings: ' + JSON.stringify(settings));
Function walkSync
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function walkSync (start, callback) {
if(fs.existsSync(start)) {
var stat = fs.statSync(start);
if (stat.isDirectory()) {
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function () {
var wm = require('./watchManager.js');
var callback = function() {
Function copyStaticFiles
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
View.prototype.copyStaticFiles = function(callback) {
var staticDirectory = 'custom/static';
utils.walkSync(staticDirectory, function(dir, directories, fileNames) {
logger.debug('Directory: ' + dir);
logger.debug('FileNames: ' + JSON.stringify(fileNames));
Function getLibraryContents
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
var getLibraryContents = function(uri, callback) {
logger.debug('Entering getLibraryContents...');
logger.debug(JSON.stringify(Libraries));
if(typeof(Libraries) === 'undefined') {
throw new Error('No libraries defined, did you call LibraryManager.init first?');
- 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"