Showing 30 of 48 total issues
Function start
has 231 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.start = function(port, dir) {
var app = express();
var server = http.createServer(app);
app.use(express.static(__dirname+'/../public'));
app.use(require('express-promise')());
Function extract
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
function extract(object, properties) {
var dest = {};
if (typeof properties == 'string')
properties = [properties];
- 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 perform
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
AddSiteTask.prototype.perform = function*() {
var manager = this.siteManager;
var siteName = this.siteName;
yield this.runNestedQuietly(manager.loadTask(false));
Function perform
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
LoadSiteManagerTask.prototype.perform = function*() {
var manager = this.siteManager;
this.doLog('Loading config.yaml...');
var data = yield fs.read(manager.path + '/config.yaml');
var config = yaml.safeLoad(data);
- 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 perform
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
LoadSiteManagerTask.prototype.perform = function*() {
var manager = this.siteManager;
this.doLog('Loading config.yaml...');
var data = yield fs.read(manager.path + '/config.yaml');
var config = yaml.safeLoad(data);
Function extract
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
function extract(object, properties) {
var dest = {};
if (typeof properties == 'string')
properties = [properties];
Function perform
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
UpgradeToRevisionTask.prototype.perform = function*() {
var site = this.site;
this.cd(this.site.path);
yield this.exec('git fetch');
Function connect
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.connect = Q.async(function*(options) {
options = Object.create(options);
options.multipleStatements = true;
var connection = mysql.createConnection(options);
Function perform
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
UpgradeSiteTask.prototype.perform = function*() {
var site = this.site;
this.cd(this.site.path);
this.doLog('Checking if site can be upgraded...');
Function connect
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.connect = Q.async(function*(options) {
if (typeof options.path != 'string')
throw new Error("sqlite database requires path option to be string");
var connection = yield Q.nfcall(sqlite.open, options.path, {});
Function perform
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
UpgradeToRevisionTask.prototype.perform = function*() {
var site = this.site;
this.cd(this.site.path);
yield this.exec('git fetch');
- 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 perform
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
LoadSiteTask.prototype.perform = function*() {
try {
this.cd(this.site.path);
yield this.exec("git fetch");
Function Task
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Task(name, perform) {
// capture the callbacks to defer the actual task performance until start() is called
Promise.call(this, function(resolve, reject) {
this._resolve = function(result) {
this.status = 'done';
Function perform
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
UpgradeSiteTask.prototype.perform = function*() {
var site = this.site;
this.cd(this.site.path);
this.doLog('Checking if site can be upgraded...');
- 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 perform
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
RestoreTask.prototype.perform = function*() {
var site = this.site;
var dataPath = fs.join(site.path, 'data');
if (!(yield fs.exists(dataPath + '/.git')))
Function perform
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
FetchTask.prototype.perform = function*() {
var manager = this.siteManager;
this.cd(manager._repoPath);
var result = yield this.exec('git fetch origin +refs/heads/*:refs/heads/*');
Function getBackups
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.getBackups = Q.async(function*(site) {
if (!(yield fs.exists(site.path + '/data/.git')))
return []; // no data, so no backups
var currentBackupRevision = yield exports.getCurrentBackupRevision(site);
Function connect
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.connect = Q.async(function*(options) {
if (typeof options.path != 'string')
throw new Error("sqlite database requires path option to be string");
var connection = yield Q.nfcall(sqlite.open, options.path, {});
- 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 (name in object)
dest[name] = extract(object[name], specification);
Avoid deeply nested control flow statements. Open
if (name.endsWith('[]')) {
name = name.substring(0, name.length - 2);
specification = { '[]': specification };
}