Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
Fix bug/weaknesses uncovered in testing
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Feb 6, 2019
1 parent c9e72e2 commit e4be5a3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


#: Run lint and then tests
check: lint
check: lint-fix
npx mocha test/test*.js

#: same thing as "make check"
Expand Down
5 changes: 3 additions & 2 deletions lib/trufstuf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ const parseBuildJson = async file => {
const buildObj = JSON.parse(buildJson);
// Recent versions of truffle seem to add __ to the end of the bytecode
for (const field of ['bytecode', 'deployedBytecode']) {
buildObj[field] = buildObj[field].replace(/_.+$/, '')
if (buildObj[field]) {
buildObj[field] = buildObj[field].replace(/_.+$/, '');
}
}
// buildObj.bytecode = buildObj.bytecode.replace(/_.+$/, '')
return buildObj;
};

Expand Down
16 changes: 8 additions & 8 deletions test/test_issue2eslint.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('issues2Eslint', function() {
fatal: false,
message: 'Head message Tail message',
mythXseverity: 'High',
severity: 3,
severity: 2,
},
res);
});
Expand Down Expand Up @@ -126,7 +126,7 @@ describe('issues2Eslint', function() {
fatal: false,
message: 'Head message Tail message',
mythXseverity: 'High',
severity: 3,
severity: 2,
}, res);
});

Expand Down Expand Up @@ -205,8 +205,8 @@ describe('issues2Eslint', function() {
const result = remappedMythXOutput.map(output => issuesObject.convertMythXReport2EsIssue(output, true));

assert.deepEqual(result, [{
errorCount: 0,
warningCount: 1,
errorCount: 1,
warningCount: 0,
fixableErrorCount: 0,
fixableWarningCount: 0,
filePath: '/tmp/contracts/simple_dao.sol',
Expand All @@ -219,7 +219,7 @@ describe('issues2Eslint', function() {
message: 'Head message',
ruleId: 'SWC-000',
mythXseverity: 'High',
severity: 3,
severity: 2,
}],
}]);
});
Expand Down Expand Up @@ -299,8 +299,8 @@ describe('issues2Eslint', function() {
issuesObject.setIssues(mythXOutput);
const result = issuesObject.getEslintIssues(true);
assert.deepEqual(result, [{
errorCount: 0,
warningCount: 1,
errorCount: 1,
warningCount: 0,
fixableErrorCount: 0,
fixableWarningCount: 0,
filePath: '/tmp/contracts/simple_dao.sol',
Expand All @@ -312,7 +312,7 @@ describe('issues2Eslint', function() {
endLine: 12,
message: 'Head message',
mythXseverity: 'High',
severity: 3,
severity: 2,
fatal: false,
}],
}])
Expand Down

0 comments on commit e4be5a3

Please sign in to comment.