Skip to content

Commit

Permalink
50-max-states-count-in-contract
Browse files Browse the repository at this point in the history
  • Loading branch information
idrabenia committed Oct 2, 2017
1 parent 5610448 commit 8653b68
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
5 changes: 4 additions & 1 deletion lib/common/tree-traversing.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,12 @@ class TreeTraversing {


TreeTraversing.typeOf = function (ctx) {
if (!ctx) {
return '';
}

const className = ctx.constructor.name;
const typeName = className.replace('Context', '');

return typeName[0].toLowerCase() + typeName.substring(1);
};

Expand Down
5 changes: 0 additions & 5 deletions lib/rules/align/brackets-align.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ class BracketsAlign extends BaseChecker {
this.validateBlock(ctx);
}

enterFunctionCallArguments(ctx) {
this.validateBlock(ctx);
}

validateBlock(ctx) {
if (typeOf(ctx.parentCtx) === 'functionDefinition') {
return;
Expand Down Expand Up @@ -64,7 +60,6 @@ class BracketsAlign extends BaseChecker {
const message = 'Open bracket must be on same line. It must be indented by other constructions by space';
this.error(ctx, 'bracket-align', message);
}

}


Expand Down
6 changes: 6 additions & 0 deletions lib/rules/best-practises/no-unused-vars.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ class NoUnusedVarsChecker extends BaseChecker {
this._trackVarUsage(ctx);
}

enterAssemblyCall(ctx) {
const firstChild = _.first(ctx.children);

firstChild && this._trackVarUsage(firstChild);
}

exitFunctionDefinition(ctx) {
VarUsageScope.isActivated(ctx) && this._reportErrorsFor(ctx);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "solhint",
"version": "1.1.1",
"version": "1.1.4",
"description": "Solidity Code Linter",
"main": "solhint.js",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion solhint.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const process = require('process');

function init () {
program
.version('1.1.1');
.version('1.1.4');

program
.usage('[options] <file> [...other_files]')
Expand Down
3 changes: 2 additions & 1 deletion test/best-practise-rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ describe('Linter', function() {
contractWith('function a(uint a) public { uint b = bytes32(a); b += 1; }'),
contractWith('function a() public returns (uint c) { return 1; }'),
contractWith('function a(uint d) public returns (uint c) { }'),
contractWith('function a(uint a, uint c) public returns (uint c);')
contractWith('function a(uint a, uint c) public returns (uint c);'),
contractWith('function a(address a) internal { assembly { t := eq(a, and(mask, calldataload(4))) } }')
];

USED_VARS.forEach(curData =>
Expand Down

0 comments on commit 8653b68

Please sign in to comment.