Merge pull request #97 from sc-forks/lint-022

Lint
pull/100/head
c-g-e-w-e-k-e- 7 years ago committed by GitHub
commit 7c0a6e9ee3
  1. 1
      .eslintrc
  2. 2
      lib/parse.js
  3. 10
      test/app.js
  4. 1
      test/assert.js
  5. 2
      test/conditional.js
  6. 1
      test/return.js
  7. 2
      test/statements.js
  8. 3
      test/util/util.js
  9. 2
      test/util/vm.js
  10. 1
      test/zeppelin.js

@ -32,6 +32,7 @@
"objectsInObjects": false, "objectsInObjects": false,
"arraysInObjects": false "arraysInObjects": false
}], }],
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true }],
"object-curly-newline": ["error", { "minProperties": 1 }], "object-curly-newline": ["error", { "minProperties": 1 }],
"object-property-newline": ["error"], "object-property-newline": ["error"],
"prefer-template": [0], "prefer-template": [0],

@ -1,4 +1,4 @@
/* eslint no-unused-expressions: ["error", { "allowShortCircuit": true }]*/ /* eslint no-unused-expressions: ["error", { "allowShortCircuit": true }] */
/** /**
* Methods in this file walk the AST and call the instrumenter * Methods in this file walk the AST and call the instrumenter

@ -60,7 +60,7 @@ describe('app', () => {
const testConfig = Object.assign({}, config); const testConfig = Object.assign({}, config);
testConfig.testrpcOptions = `--account="${privateKey},${balance}" --port 8777`; testConfig.testrpcOptions = `--account="${privateKey},${balance}" --port 8777`;
testConfig.dir = './mock', testConfig.dir = './mock';
testConfig.norpc = false; testConfig.norpc = false;
testConfig.port = 8777; testConfig.port = 8777;
@ -79,7 +79,7 @@ describe('app', () => {
const testConfig = Object.assign({}, config); const testConfig = Object.assign({}, config);
testConfig.testCommand = 'mocha --timeout 5000 > /dev/null 2>&1'; testConfig.testCommand = 'mocha --timeout 5000 > /dev/null 2>&1';
testConfig.dir = './mock', testConfig.dir = './mock';
testConfig.norpc = false; testConfig.norpc = false;
testConfig.port = 8888; testConfig.port = 8888;
@ -98,7 +98,7 @@ describe('app', () => {
const testConfig = Object.assign({}, config); const testConfig = Object.assign({}, config);
testConfig.testCommand = 'node ../test/util/mockTestCommand.js'; testConfig.testCommand = 'node ../test/util/mockTestCommand.js';
testConfig.dir = './mock', testConfig.dir = './mock';
testConfig.norpc = false; testConfig.norpc = false;
testConfig.port = 8888; testConfig.port = 8888;
@ -118,7 +118,7 @@ describe('app', () => {
const testConfig = Object.assign({}, config); const testConfig = Object.assign({}, config);
testConfig.dir = './mock', testConfig.dir = './mock';
testConfig.norpc = false; testConfig.norpc = false;
testConfig.port = 8889; testConfig.port = 8889;
@ -159,7 +159,7 @@ describe('app', () => {
};`; };`;
const testConfig = Object.assign({}, config); const testConfig = Object.assign({}, config);
testConfig.dir = './mock', testConfig.dir = './mock';
testConfig.norpc = false; testConfig.norpc = false;
testConfig.port = 8555; // Manually inspect that port is actually set to 8999 testConfig.port = 8555; // Manually inspect that port is actually set to 8999

@ -106,5 +106,4 @@ describe('asserts and requires', () => {
done(); done();
}).catch(done); }).catch(done);
}); });
}); });

@ -199,5 +199,5 @@ describe('conditional statements', () => {
assert.deepEqual(mapping[filePath].f, {1: 1}); assert.deepEqual(mapping[filePath].f, {1: 1});
done(); done();
}).catch(done); }).catch(done);
});*/ }); */
}); });

@ -5,7 +5,6 @@ const getInstrumentedVersion = require('./../lib/instrumentSolidity.js');
const util = require('./util/util.js'); const util = require('./util/util.js');
describe('return statements', () => { describe('return statements', () => {
it('should compile after instrumenting function that returns true', () => { it('should compile after instrumenting function that returns true', () => {
const contract = util.getCode('return/return.sol'); const contract = util.getCode('return/return.sol');
const info = getInstrumentedVersion(contract, 'test.sol'); const info = getInstrumentedVersion(contract, 'test.sol');

@ -60,7 +60,7 @@ describe('generic statements', () => {
util.report(output.errors); util.report(output.errors);
assert.fail('WRONG'); // We shouldn't hit this. assert.fail('WRONG'); // We shouldn't hit this.
} catch (err) { } catch (err) {
(err.actual === 'WRONG') ? assert(false): assert(true); (err.actual === 'WRONG') ? assert(false) : assert(true);
} }
}); });

@ -11,8 +11,7 @@ module.exports.getCode = function getCode(_path) {
}; };
module.exports.report = function report(errors) { module.exports.report = function report(errors) {
if (errors) {
if (errors){
errors.forEach(error => { errors.forEach(error => {
if (error.indexOf('Warning') === -1) { if (error.indexOf('Warning') === -1) {
throw new Error(`Instrumented solidity invalid: ${errors}`); throw new Error(`Instrumented solidity invalid: ${errors}`);

@ -123,7 +123,7 @@ function callMethod(vm, abi, address, functionName, args) {
events.pop(); events.pop();
shell.rm('./allFiredEvents'); shell.rm('./allFiredEvents');
resolve(events); resolve(events);
} catch (err) { } catch (e) {
resolve([]); resolve([]);
} }
}); });

@ -5,7 +5,6 @@ const getInstrumentedVersion = require('./../lib/instrumentSolidity.js');
const util = require('./util/util.js'); const util = require('./util/util.js');
describe('Battery test of production contracts: OpenZeppelin', () => { describe('Battery test of production contracts: OpenZeppelin', () => {
it('should compile after instrumenting zeppelin-solidity/Bounty.sol', () => { it('should compile after instrumenting zeppelin-solidity/Bounty.sol', () => {
const bounty = getInstrumentedVersion(util.getCode('zeppelin/Bounty.sol'), 'Bounty.sol'); const bounty = getInstrumentedVersion(util.getCode('zeppelin/Bounty.sol'), 'Bounty.sol');
const ownable = getInstrumentedVersion(util.getCode('zeppelin/Ownable.sol'), 'Ownable.sol'); const ownable = getInstrumentedVersion(util.getCode('zeppelin/Ownable.sol'), 'Ownable.sol');

Loading…
Cancel
Save