Showing 8 of 20 total issues
Function exports
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function(varPath, port, program) {
//Start Server
var app = express();
var localController;
- 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 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(varPath, port, program) {
//Start Server
var app = express();
var localController;
Function Files
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
function Files(attributes, baseDir, assets) {
Files.super_.call(this, attributes, baseDir);
//get HTML files in the experiment folder
this.filenames = fs.readdirSync(baseDir);
- 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 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(name){
var d = q.defer();
try{
var result = fs.readFileSync(".optcli/" + name, {encoding:"utf-8"});
d.resolve(result);
Function exports
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(folder) {
//find the variation
var varPath = path.resolve(process.cwd(), folder);
var variation = new Variation({}, varPath);
variation.loadFromFile();
Function Files
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function Files(attributes, baseDir, assets) {
Files.super_.call(this, attributes, baseDir);
//get HTML files in the experiment folder
this.filenames = fs.readdirSync(baseDir);
Function createRemote
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Variation.prototype.createRemote = function(client, remote) {
//assume assets are in experiment.baseDir
var assets = new Assets({}, path.normalize(this.baseDir + "/.."));
if (assets.JSONFileExists()) {
logger.log("info", "assets file found, loading");
Function LocalController
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function LocalController(variation, port) {
this.variation = variation;
//assume the directory above the variation
//maybe move this to Experiment?
this.experiment = new Experiment({}, path.normalize(variation.baseDir + "/.."));