Lint fixes
This commit is contained in:
parent
2e3c598380
commit
6fc5c166da
7
Makefile
7
Makefile
|
@ -17,7 +17,7 @@ endif
|
|||
endif
|
||||
|
||||
.PHONY: clean run test run-amazon c-preload optional-d-support prereqs node_modules bower_modules
|
||||
.PHONY: dist
|
||||
.PHONY: dist lint
|
||||
prereqs: optional-d-support node_modules c-preload bower_modules
|
||||
|
||||
ifeq "" "$(shell which gdc)"
|
||||
|
@ -39,12 +39,15 @@ $(BOWER_MODULES): bower.json $(NODE_MODULES)
|
|||
$(NODE) ./node_modules/bower/bin/bower install
|
||||
@touch $@
|
||||
|
||||
lint: $(NODE_MODULES)
|
||||
$(NODE) ./node_modules/.bin/jshint app.js $(shell find lib static -name '*.js' -not -path 'static/ext/*')
|
||||
|
||||
LANG:=C++
|
||||
|
||||
node_modules: $(NODE_MODULES)
|
||||
bower_modules: $(BOWER_MODULES)
|
||||
|
||||
test:
|
||||
test: $(NODE_MODULES) lint
|
||||
(cd test; $(NODE) test.js)
|
||||
$(MAKE) -C c-preload test
|
||||
@echo Tests pass
|
||||
|
|
10
app.js
10
app.js
|
@ -169,7 +169,7 @@ function ClientOptionsHandler(fileSources) {
|
|||
environment: env
|
||||
};
|
||||
text = JSON.stringify(options);
|
||||
}
|
||||
};
|
||||
this.handler = function getClientOptions(req, res) {
|
||||
res.set('Content-Type', 'application/json');
|
||||
res.set('Cache-Control', 'public, max-age=' + staticMaxAgeMs);
|
||||
|
@ -422,8 +422,8 @@ function shortUrlHandler(req, res, next) {
|
|||
var bits = req.url.split("/");
|
||||
if (bits.length !== 2 || req.method !== "GET") return next();
|
||||
var key = process.env.GOOGLE_API_KEY;
|
||||
var googleApiUrl = 'https://www.googleapis.com/urlshortener/v1/url?shortUrl=http://goo.gl/'
|
||||
+ encodeURIComponent(bits[1]) + '&key=' + key;
|
||||
var googleApiUrl = 'https://www.googleapis.com/urlshortener/v1/url?shortUrl=http://goo.gl/' +
|
||||
encodeURIComponent(bits[1]) + '&key=' + key;
|
||||
https.get(googleApiUrl, function (response) {
|
||||
var responseText = '';
|
||||
response.on('data', function (d) {
|
||||
|
@ -431,8 +431,8 @@ function shortUrlHandler(req, res, next) {
|
|||
});
|
||||
response.on('end', function () {
|
||||
if (response.statusCode != 200) {
|
||||
console.log("Failed to resolve short URL " + bits[1] + " - got response "
|
||||
+ response.statusCode + " : " + responseText);
|
||||
console.log("Failed to resolve short URL " + bits[1] + " - got response " +
|
||||
response.statusCode + " : " + responseText);
|
||||
return next();
|
||||
}
|
||||
|
||||
|
|
|
@ -82,19 +82,18 @@
|
|||
// Now follow the chains of used labels, marking any weak references they refer
|
||||
// to as also used. We iteratively do this until either no new labels are found,
|
||||
// or we hit a limit (only here to prevent a pathological case from hanging).
|
||||
function markUsed(label) { labelsUsed[label] = true; }
|
||||
var MaxLabelIterations = 10;
|
||||
for (var iter = 0; iter < MaxLabelIterations; ++iter) {
|
||||
var toAdd = [];
|
||||
_.each(labelsUsed, function (t, label) {
|
||||
_.each(labelsUsed, function (t, label) { // jshint ignore:line
|
||||
_.each(weakUsages[label], function (nowused) {
|
||||
if (labelsUsed[nowused]) return;
|
||||
toAdd.push(nowused);
|
||||
});
|
||||
});
|
||||
if (!toAdd) break;
|
||||
_.each(toAdd, function (label) {
|
||||
labelsUsed[label] = true;
|
||||
});
|
||||
_.each(toAdd, markUsed);
|
||||
}
|
||||
return labelsUsed;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ var child_process = require('child_process'),
|
|||
httpProxy = require('http-proxy'),
|
||||
LRU = require('lru-cache'),
|
||||
fs = require('fs-extra'),
|
||||
Promise = require('promise'),
|
||||
Promise = require('promise'), // jshint ignore:line
|
||||
Queue = require('promise-queue'),
|
||||
asm = require('./asm');
|
||||
|
||||
|
@ -48,7 +48,7 @@ var stubText = null;
|
|||
|
||||
function identity(x) {
|
||||
return x;
|
||||
};
|
||||
}
|
||||
|
||||
function initialise(gccProps_, compilerProps_) {
|
||||
gccProps = gccProps_;
|
||||
|
@ -403,7 +403,7 @@ function CompileHandler() {
|
|||
if (source === undefined) {
|
||||
return next(new Error("Bad request"));
|
||||
}
|
||||
var options = req.body.options.split(' ').filter(identity);
|
||||
options = req.body.options.split(' ').filter(identity);
|
||||
var filters = req.body.filters;
|
||||
compileObj.compile(source, compiler, options, filters).then(
|
||||
function (result) {
|
||||
|
|
|
@ -2,7 +2,8 @@ var fs = require('fs'),
|
|||
child_process = require('child_process'),
|
||||
temp = require('temp'),
|
||||
path = require('path'),
|
||||
Promise = require('promise');
|
||||
Promise = require('promise') // jshint ignore:line
|
||||
;
|
||||
|
||||
function cleanAndGetIndexes(text) {
|
||||
var addRules = {
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
"devDependencies": {
|
||||
"supervisor": "*",
|
||||
"bower": "*",
|
||||
"requirejs": "*"
|
||||
"requirejs": "*",
|
||||
"jshint": "*"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "make test"
|
||||
|
|
|
@ -117,8 +117,8 @@ define(function (require) {
|
|||
}, this);
|
||||
this.container.layoutManager.createDragSource(this.domRoot.find(".status").parent(), outputConfig);
|
||||
this.domRoot.find(".status").parent().click(_.bind(function () {
|
||||
var insertPoint = hub.findParentRowOrColumn(this.container)
|
||||
|| this.container.layoutManager.root.contentItems[0];
|
||||
var insertPoint = hub.findParentRowOrColumn(this.container) ||
|
||||
this.container.layoutManager.root.contentItems[0];
|
||||
insertPoint.addChild(outputConfig());
|
||||
}, this));
|
||||
|
||||
|
@ -133,8 +133,8 @@ define(function (require) {
|
|||
this.container.layoutManager.createDragSource(
|
||||
this.domRoot.find('.btn.add-compiler'), cloneComponent);
|
||||
this.domRoot.find('.btn.add-compiler').click(_.bind(function () {
|
||||
var insertPoint = hub.findParentRowOrColumn(this.container)
|
||||
|| this.container.layoutManager.root.contentItems[0];
|
||||
var insertPoint = hub.findParentRowOrColumn(this.container) ||
|
||||
this.container.layoutManager.root.contentItems[0];
|
||||
insertPoint.addChild(cloneComponent());
|
||||
}, this));
|
||||
}
|
||||
|
|
|
@ -164,8 +164,8 @@ define(function (require) {
|
|||
this.container.layoutManager.createDragSource(
|
||||
this.domRoot.find('.btn.add-compiler'), compilerConfig);
|
||||
this.domRoot.find('.btn.add-compiler').click(_.bind(function () {
|
||||
var insertPoint = hub.findParentRowOrColumn(this.container)
|
||||
|| this.container.layoutManager.root.contentItems[0];
|
||||
var insertPoint = hub.findParentRowOrColumn(this.container) ||
|
||||
this.container.layoutManager.root.contentItems[0];
|
||||
insertPoint.addChild(compilerConfig);
|
||||
}, this));
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Taken from https://github.com/Nanonid/rison at 917679fb6cafa15e2a186cd5a47163792899b321
|
||||
|
||||
/* jshint ignore:start */
|
||||
// Uses CommonJS, AMD or browser globals to create a module.
|
||||
// Based on: https://github.com/umdjs/umd/blob/master/commonjsStrict.js
|
||||
(function (root, factory) {
|
||||
|
|
Loading…
Reference in New Issue