Comparing version 0.2.2 to 0.3.0
@@ -1,2 +0,2 @@ | ||
#Contributing rules to this repository | ||
# Contributing rules to this repository | ||
@@ -100,3 +100,2 @@ Ideally, you would want to write a rule that complies with the Solidity [Style Guide](http://solidity.readthedocs.io/en/latest/style-guide.html). However, if you feel that a certain rule is not mentioned in the guide or contradicts a rule mentioned in the guide but is crucial to the linter, please raise an Issue to discuss this rule. Once, finalized, you may proceed to develop the rule, test it, and make a PR. | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'); | ||
@@ -135,3 +134,3 @@ | ||
##That's it! | ||
## That's it! | ||
Yep, you're done and ready to make a Pull Request. | ||
@@ -141,3 +140,3 @@ | ||
#Functions available to rule implementers | ||
# Functions available to rule implementers | ||
@@ -144,0 +143,0 @@ ```getText (node)``` - get source code for the specified node. If no arguments given, it returns the complete source code |
@@ -8,6 +8,6 @@ /** | ||
var colors = require ('colors'), | ||
fs = require ('fs'), | ||
sort = require('lodash/sortBy'); | ||
require ('colors'); | ||
var sort = require('lodash/sortBy'); | ||
function repeat (str, count) { | ||
@@ -53,3 +53,3 @@ return Array (count+1).join (str); | ||
if (!counts[error.type]) { | ||
if (!counts[error.type]) { | ||
counts[error.type] = 0; | ||
@@ -56,0 +56,0 @@ } |
@@ -77,3 +77,3 @@ /** | ||
c = sourceCode.getTextOnLine (endingLineNumber); | ||
} catch (e) {} | ||
} catch (e) { /* ignore */ } | ||
@@ -80,0 +80,0 @@ if ( |
@@ -12,3 +12,3 @@ /** | ||
var camelCaseRegEx = /^[A-Z][a-z][a-zA-Z]*[a-z]*$/; | ||
var camelCaseRegEx = /^([A-Z][A-Za-z0-9]+)+$/; | ||
var eventsToWatch = { | ||
@@ -15,0 +15,0 @@ 'ContractStatement': 'Contract', |
@@ -89,3 +89,3 @@ /** | ||
levelOneIndentRegExp = new RegExp ('^\\n' + BASE_INDENTATION_STYLE + '$'), | ||
endingLineRegExp = new RegExp ('^' + BASE_INDENTATION_STYLE + '\\S$'); | ||
endingLineRegExp = new RegExp ('^' + BASE_INDENTATION_STYLE + '(\\S| *)$'); //either a non-whitespace character or 1 extra whitespace followed by * (closing of multi-line comment) | ||
@@ -92,0 +92,0 @@ if (emitted.exit) { |
@@ -432,3 +432,3 @@ /** | ||
(!/^\n[ \t]*$/.test (stringBetwLastModifAndLBrace)) && context.report ({ | ||
(!/^[ \t]*\n[ \t]*$/.test (stringBetwLastModifAndLBrace)) && context.report ({ | ||
node: node.body, | ||
@@ -435,0 +435,0 @@ message: 'Function \'' + node.name + '\': Opening brace must be on a new line immediately after the last modifier.' |
@@ -29,3 +29,4 @@ /** | ||
sourceCode = context.getSourceCode (), | ||
pragmaParent = sourceCode.getParent (node); | ||
pragmaParent = sourceCode.getParent (node), | ||
error; | ||
@@ -41,3 +42,3 @@ if (emitted.exit) { | ||
if (pragmaParent.type !== 'Program') { | ||
var error = { | ||
error = { | ||
node: node, | ||
@@ -53,3 +54,3 @@ message: 'Pragma Directive \"' + sourceCode.getText (node) + | ||
if (node.start !== pragmaParent.body [0].start) { | ||
var error = { | ||
error = { | ||
node: node, | ||
@@ -66,2 +67,2 @@ message: 'Pragma Directive \"' + sourceCode.getText (node) + | ||
}; | ||
}; |
@@ -231,3 +231,10 @@ /** | ||
context.on ('AssignmentExpression', function (emitted) { | ||
var node = emitted.node, op = node.operator; | ||
/** | ||
* node.operator is refined here by adding backslash before all the 'special' characters. | ||
* 'special' chars are thos chars that are part of solidity assignment operators and, if used without backslash in JS RegExp, | ||
* behave as wildcard characters. So to make sure they're treated as simple strings, we add '\' before them. | ||
* As of today, these chars include: * / + | ^ | ||
*/ | ||
var node = emitted.node, | ||
op = node.operator.replace (/([\+\*\/\|\^])/g, '\\$1'), opLength = node.operator.length; | ||
@@ -238,14 +245,10 @@ if (emitted.exit) { | ||
var charsAfterLeftNode = sourceCode.getNextChars (node.left, 1 + op.length), | ||
charsBeforeRightNode = sourceCode.getPrevChars (node.right, 1 + op.length); | ||
// If expression is 'abc *= def;', then charsAfterLeftNode will contain ' *= d'. | ||
var charsAfterLeftNode = sourceCode.getNextChars (node.left, 3 + opLength), | ||
validationRegexp = new RegExp ('^ ' + op + ' [^\\s]$'); | ||
(charsAfterLeftNode !== ' ' + op) && context.report ({ | ||
(!validationRegexp.test (charsAfterLeftNode)) && context.report ({ | ||
node: node.left, | ||
message: '\'' + op + '\' must be preceded by exactly a single space.' | ||
message: 'Assignment operator must have exactly single space on both sides of it.' | ||
}); | ||
(charsBeforeRightNode !== op + ' ') && context.report ({ | ||
node: node.right, | ||
message: '\'' + op + '\' must be succeded by exactly a single space.' | ||
}); | ||
}); | ||
@@ -252,0 +255,0 @@ |
@@ -19,4 +19,3 @@ /** | ||
); | ||
} | ||
}, | ||
}; |
{ | ||
"name": "solium", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "A flexible, stand-alone linter for Ethereum Solidity", | ||
@@ -10,3 +10,4 @@ "main": "./lib/solium.js", | ||
"scripts": { | ||
"test": "./node_modules/.bin/mocha ./test/*/*.js ./test/*/*/*.js ./test/*/*/*/*.js --reporter spec" | ||
"test": "mocha --require should --reporter spec --recursive", | ||
"lint": "eslint ." | ||
}, | ||
@@ -35,2 +36,3 @@ "keywords": [ | ||
"chai": "^3.5.0", | ||
"eslint": "^3.12.2", | ||
"mocha": "^3.0.2", | ||
@@ -37,0 +39,0 @@ "should": "^11.0.0", |
@@ -9,3 +9,3 @@ ![solium](https://cloud.githubusercontent.com/assets/12758282/18283522/4b206522-7483-11e6-9bcd-2a70ebc8cfdb.png) | ||
#Install | ||
# Install | ||
```bash | ||
@@ -15,3 +15,3 @@ npm install -g solium | ||
#Usage | ||
# Usage | ||
In the root directory of your DApp, run the following: | ||
@@ -38,3 +38,3 @@ ```bash | ||
#Additional Options | ||
# Additional Options | ||
@@ -49,3 +49,3 @@ 1. Use ```solium --watch``` to enable Hot loading (Hot swapping). | ||
#Plugging in your custom rules | ||
# Plugging in your custom rules | ||
-> Open up the ```.soliumrc.json``` configuration file and set the value of ```custom-rules-filename``` to the path of the file that defines your rules. You can either provide an absolute path or a path relative to the directory in which .soliumrc.json resides. For example: ```"custom-rules-filename": "./my-rules.js"``` | ||
@@ -104,3 +104,3 @@ | ||
#Integrate Solium in your app | ||
# Integrate Solium in your app | ||
To access Solium's API, first install it: | ||
@@ -111,3 +111,3 @@ | ||
``` | ||
##Usage | ||
## Usage | ||
```js | ||
@@ -133,6 +133,6 @@ let Solium = require ('solium'), | ||
#Contributing | ||
# Contributing | ||
Please see the [Developer Guide](https://github.com/duaraghav8/Solium/blob/master/docs/DEVELOPER.md) to understand how to contribute rules to this repository. | ||
##Setup | ||
## Setup | ||
@@ -144,3 +144,3 @@ Clone the repository, traverse to the root directory of the project, then install dependencies: | ||
##Running Tests | ||
## Running Tests | ||
``` | ||
@@ -150,3 +150,3 @@ npm test | ||
##Contributors and Testers | ||
## Contributors and Testers | ||
[Elena Dimitrova](https://github.com/elenadimitrova) | ||
@@ -158,3 +158,5 @@ | ||
#License | ||
##MIT | ||
[Ulrich Petri](https://github.com/ulope) | ||
# License | ||
## MIT |
@@ -8,3 +8,2 @@ /** | ||
var should = require ('should'); | ||
var RuleContext = require ('../../lib/rule-context'), | ||
@@ -109,3 +108,3 @@ Solium = require ('../../lib/solium'), | ||
rcObject.on ('ContractStatement', function (emitted) { | ||
rcObject.on ('ContractStatement', function () { | ||
Solium.reset (); | ||
@@ -118,2 +117,2 @@ done (); | ||
}); | ||
}); |
@@ -8,3 +8,2 @@ /** | ||
var should = require ('should'); | ||
var rules = require ('../../lib/rules'), | ||
@@ -134,2 +133,2 @@ path = require ('path'); | ||
}); | ||
}); |
@@ -8,4 +8,5 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'); | ||
var wrappers = require ('../../../utils/wrappers'); | ||
var toContract = wrappers.toContract; | ||
var userConfig = { | ||
@@ -22,3 +23,3 @@ "custom-rules-filename": null, | ||
var code = 'uint[] x;', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -34,3 +35,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'uint[10] x;', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -50,3 +51,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'uint[ ] x;', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -63,3 +64,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'uint[ ] x;', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -76,3 +77,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'uint[\n] x;', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -89,3 +90,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'uint[ ] x;', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -102,3 +103,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'uint [] x;', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -115,3 +116,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'string\n[] x;', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -128,3 +129,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'bytes32\t[] x;', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -141,3 +142,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'uint [ ] x;', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -151,2 +152,2 @@ errors.constructor.name.should.equal ('Array'); | ||
}); | ||
}); |
@@ -8,4 +8,4 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'), | ||
wrappers = require ('../../../utils/wrappers'), | ||
fs = require ('fs'), | ||
@@ -21,2 +21,4 @@ path = require ('path'); | ||
var addPragma = wrappers.addPragma; | ||
describe ('[RULE] blank-lines: Acceptances', function () { | ||
@@ -26,3 +28,3 @@ | ||
var code = fs.readFileSync (path.join (__dirname, './accept/contract.sol'), 'utf8'), | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -38,3 +40,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = fs.readFileSync (path.join (__dirname, './accept/library.sol'), 'utf8'), | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -50,3 +52,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = fs.readFileSync (path.join (__dirname, './accept/contract-single.sol'), 'utf8'), | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -62,3 +64,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = fs.readFileSync (path.join (__dirname, './accept/library-single.sol'), 'utf8'), | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -74,3 +76,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = fs.readFileSync (path.join (__dirname, './accept/function.sol'), 'utf8'), | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -86,3 +88,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'import * as x from "y";\nimport * as x from "y";\nimport * as x from "y";\n\n\ncontract Yoda {} import * as foo from "bar.sol";', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -103,3 +105,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = fs.readFileSync (path.join (__dirname, './reject/contract.sol'), 'utf8'), | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -119,3 +121,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = fs.readFileSync (path.join (__dirname, './reject/library.sol'), 'utf8'), | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -135,3 +137,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = fs.readFileSync (path.join (__dirname, './reject/function.sol'), 'utf8'), | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -138,0 +140,0 @@ errors.constructor.name.should.equal ('Array'); |
@@ -8,4 +8,6 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'); | ||
var wrappers = require ('../../../utils/wrappers'); | ||
var toContract = wrappers.toContract; | ||
var addPragma = wrappers.addPragma; | ||
@@ -26,7 +28,12 @@ var userConfig = { | ||
'contract He {}', | ||
'contract HeLlOWoRlD {}', | ||
'contract HeLLOWORLd {}' | ||
'contract HELlOWoRlD {}', | ||
'contract HeLLOWORLd {}', | ||
'contract MyToken2 {}', | ||
'contract My29Token10 {}', | ||
'contract M123 {}' | ||
]; | ||
var errors; | ||
code = code.map(function(item){return addPragma(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -52,2 +59,14 @@ errors.constructor.name.should.equal ('Array'); | ||
errors = Solium.lint (code [5], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (0); | ||
errors = Solium.lint (code [6], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (0); | ||
errors = Solium.lint (code [7], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (0); | ||
Solium.reset (); | ||
@@ -62,7 +81,12 @@ done (); | ||
'library He {}', | ||
'library HeLlOWoRlD {}', | ||
'library HeLLOWORLd {}' | ||
'library HELlOWoRlD {}', | ||
'library HeLLOWORLd {}', | ||
'library MyToken2 {}', | ||
'library My29Token10 {}', | ||
'library M123 {}' | ||
]; | ||
var errors; | ||
code = code.map(function(item){return addPragma(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -88,2 +112,14 @@ errors.constructor.name.should.equal ('Array'); | ||
errors = Solium.lint (code [5], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (0); | ||
errors = Solium.lint (code [6], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (0); | ||
errors = Solium.lint (code [7], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (0); | ||
Solium.reset (); | ||
@@ -95,10 +131,15 @@ done (); | ||
var code = [ | ||
'event Hello', | ||
'event HelloWorld', | ||
'event He', | ||
'event HeLlOWoRlD', | ||
'event HeLLOWORLd' | ||
'event Hello();', | ||
'event HelloWorld();', | ||
'event He();', | ||
'event HELlOWoRlD();', | ||
'event HeLLOWORLd();', | ||
'event MyToken2();', | ||
'event My29Token10();', | ||
'event M123();' | ||
]; | ||
var errors; | ||
code = code.map(function(item){return toContract(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -124,2 +165,14 @@ errors.constructor.name.should.equal ('Array'); | ||
errors = Solium.lint (code [5], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (0); | ||
errors = Solium.lint (code [6], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (0); | ||
errors = Solium.lint (code [7], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (0); | ||
Solium.reset (); | ||
@@ -134,7 +187,12 @@ done (); | ||
'struct He {}', | ||
'struct HeLlOWoRlD {}', | ||
'struct HeLLOWORLd {}' | ||
'struct HELlOWoRlD {}', | ||
'struct HeLLOWORLd {}', | ||
'struct MyToken2 {}', | ||
'struct My29Token10 {}', | ||
'struct M123 {}' | ||
]; | ||
var errors; | ||
code = code.map(function(item){return toContract(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -160,2 +218,14 @@ errors.constructor.name.should.equal ('Array'); | ||
errors = Solium.lint (code [5], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (0); | ||
errors = Solium.lint (code [6], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (0); | ||
errors = Solium.lint (code [7], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (0); | ||
Solium.reset (); | ||
@@ -173,12 +243,11 @@ done (); | ||
'contract hello {}', | ||
'contract HElloWorld {}', | ||
'contract H {}', | ||
'contract h {}', | ||
'contract Hello1World {}', | ||
'contract h {}', | ||
'contract Hello123 {}', | ||
'contract Hello_World {}', | ||
'contract hello_1world {}' | ||
]; | ||
var errors; | ||
code = code.map(function(item){return addPragma(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -204,14 +273,2 @@ errors.constructor.name.should.equal ('Array'); | ||
errors = Solium.lint (code [5], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (1); | ||
errors = Solium.lint (code [6], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (1); | ||
errors = Solium.lint (code [7], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (1); | ||
Solium.reset (); | ||
@@ -223,13 +280,12 @@ done (); | ||
var code = [ | ||
'contract hello {}', | ||
'contract HElloWorld {}', | ||
'contract H {}', | ||
'contract h {}', | ||
'contract Hello1World {}', | ||
'contract h {}', | ||
'contract Hello123 {}', | ||
'contract Hello_World {}', | ||
'library hello {}', | ||
'library H {}', | ||
'library h {}', | ||
'library Hello_World {}', | ||
'library hello_1world {}' | ||
]; | ||
var errors; | ||
code = code.map(function(item){return addPragma(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -255,14 +311,2 @@ errors.constructor.name.should.equal ('Array'); | ||
errors = Solium.lint (code [5], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (1); | ||
errors = Solium.lint (code [6], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (1); | ||
errors = Solium.lint (code [7], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (1); | ||
Solium.reset (); | ||
@@ -274,13 +318,12 @@ done (); | ||
var code = [ | ||
'contract hello {}', | ||
'contract HElloWorld {}', | ||
'contract H {}', | ||
'contract h {}', | ||
'contract Hello1World {}', | ||
'contract h {}', | ||
'contract Hello123 {}', | ||
'contract Hello_World {}', | ||
'event hello();', | ||
'event H();', | ||
'event h();', | ||
'event Hello_World();', | ||
'event hello_1world();' | ||
]; | ||
var errors; | ||
code = code.map(function(item){return toContract(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -306,14 +349,2 @@ errors.constructor.name.should.equal ('Array'); | ||
errors = Solium.lint (code [5], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (1); | ||
errors = Solium.lint (code [6], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (1); | ||
errors = Solium.lint (code [7], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (1); | ||
Solium.reset (); | ||
@@ -325,13 +356,12 @@ done (); | ||
var code = [ | ||
'contract hello {}', | ||
'contract HElloWorld {}', | ||
'contract H {}', | ||
'contract h {}', | ||
'contract Hello1World {}', | ||
'contract h {}', | ||
'contract Hello123 {}', | ||
'contract Hello_World {}', | ||
'struct hello {}', | ||
'struct H {}', | ||
'struct h {}', | ||
'struct Hello_World {}', | ||
'struct hello_1world {}' | ||
]; | ||
var errors; | ||
code = code.map(function(item){return toContract(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -357,14 +387,2 @@ errors.constructor.name.should.equal ('Array'); | ||
errors = Solium.lint (code [5], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (1); | ||
errors = Solium.lint (code [6], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (1); | ||
errors = Solium.lint (code [7], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (1); | ||
Solium.reset (); | ||
@@ -374,2 +392,2 @@ done (); | ||
}); | ||
}); |
@@ -8,7 +8,5 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'), | ||
fs = require ('fs'), | ||
path = require ('path'); | ||
var Solium = require ('../../../../lib/solium'); | ||
var wrappers = require ('../../../utils/wrappers'); | ||
var toContract = wrappers.toContract; | ||
var userConfig = { | ||
@@ -24,3 +22,3 @@ "custom-rules-filename": null, | ||
it ('should reject contracts using suicide', function (done) { | ||
var code = 'function foo () { suicide(0x0); }', | ||
var code = toContract('function foo () { suicide(0x0); }'), | ||
@@ -27,0 +25,0 @@ errors = Solium.lint (code, userConfig); |
@@ -8,7 +8,8 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'), | ||
wrappers = require ('../../../utils/wrappers'), | ||
fs = require ('fs'), | ||
path = require ('path'); | ||
var toContract = wrappers.toContract; | ||
var userConfig = { | ||
@@ -25,3 +26,3 @@ "custom-rules-filename": null, | ||
var code = fs.readFileSync (path.join (__dirname, './accept/double-quoted.sol'), 'utf8'), | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -42,3 +43,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = fs.readFileSync (path.join (__dirname, './reject/single-quoted.sol'), 'utf8'), | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -52,2 +53,2 @@ errors.constructor.name.should.equal ('Array'); | ||
}); | ||
}); |
@@ -8,3 +8,2 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'), | ||
@@ -50,2 +49,2 @@ fs = require ('fs'), | ||
}); | ||
}); |
@@ -8,5 +8,8 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'); | ||
var wrappers = require ('../../../utils/wrappers'); | ||
var toContract = wrappers.toContract; | ||
var toFunction = wrappers.toFunction; | ||
var addPragma = wrappers.addPragma; | ||
var userConfig = { | ||
@@ -23,3 +26,3 @@ "custom-rules-filename": null, | ||
var code = 'function abstractFunc (uint x, string y) public returns (boolean);', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -35,3 +38,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'contract Visual {}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -42,3 +45,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'library Visual {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -49,3 +52,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function foobar (bytes32 name) returns (address) {\n\t/*body*/\n}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -56,3 +59,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'struct Student {\n\tstring name;\n\tuint age;\n\taddress account\n}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -63,3 +66,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'for (var i = 0; i < 10; i++) {\n\thello ();\n}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -70,3 +73,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'uint i = 0; while (i < 10) {\n\ti++;\n}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -77,3 +80,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'uint i = 0; do {\n\ti++;\n}\nwhile (i < 10);'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -89,3 +92,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'if (true) { hello (); }', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -96,3 +99,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {\n\thello ();\n} else if (true) {\n\tworld ();\n} else {\n\tfoobar ();\n}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -103,3 +106,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function foo () {hello ();}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -110,3 +113,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function foo () {\n\thello ();\n}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -125,3 +128,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true)\nnewNumber = (10 * 78 + 982 % 6**2);\nelse\nnewNumber = 0;'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -132,3 +135,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true)\n\tlaunchEvent ("foo bar!");'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -139,3 +142,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true)\ncreateStructObject ({ name: "Chuck Norris", age: "inf" });'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -152,3 +155,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'function lotsOfArgs (\n\tuint x,\n\tstring y,\n\taddress z\n) {\n\tfoobar ();\n}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -164,3 +167,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'function modifs ()\npublic\nowner\npriced\nreturns (uint)\n{\n\tfoobar ();\n}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -171,3 +174,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function modifs (\n\tuint x,\n\tstring y\n)\npublic\nowner\npriced\nreturns (uint)\n{\n\tfoobar ();\n}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -182,2 +185,8 @@ errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (0); | ||
code = 'function modifs (\n\tuint x,\n\tstring y\n)\npublic\nowner\npriced\nreturns (uint) \t\n{\n\tfoobar ();\n}'; | ||
errors = Solium.lint (toContract(code), userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (0); | ||
@@ -190,3 +199,3 @@ Solium.reset (); | ||
var code = 'function modifs ()\npublic\nowner\npriced(0)\npayable\n{\n\tfoobar ();\n}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -202,3 +211,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'function baseArgs ()\n\tA (10)\n\tB ("hello")\n\tC (0x0)\n\tD (frodo)\n{\n\tfoobar ();\n}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -214,3 +223,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'if (true) {h();} else if (true) {h();} else {h();}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -221,3 +230,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {h();} else {h();}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -228,3 +237,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {h();} else if (true) {h();}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -235,3 +244,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {h();} else if (true)\nhello ();'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -242,3 +251,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {h();} else if (true)\nhello ();'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -255,7 +264,7 @@ errors.constructor.name.should.equal ('Array'); | ||
describe ('[RULE] lbrace: Rejections', function (done) { | ||
describe ('[RULE] lbrace: Rejections', function () { | ||
it ('should reject any opening brace which is not preceded by EXACTLY single space (exception: functions with modifiers)', function (done) { | ||
var code = 'contract FooBar{}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -266,3 +275,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'contract FooBar {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -273,3 +282,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'contract FooBar\t{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -280,3 +289,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'contract FooBar/*comment*/{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -288,3 +297,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'library FooBar{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -295,3 +304,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'library FooBar {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -302,3 +311,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'library FooBar\t{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -309,3 +318,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'library FooBar/*comment*/{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -317,3 +326,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true){}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -324,3 +333,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -331,3 +340,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true)\t{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -338,3 +347,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true)/*comment*/{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -346,3 +355,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {} else if (true){}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -353,3 +362,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {} else if (true) {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -360,3 +369,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {} else if (true)\t{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -367,3 +376,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {} else if (true)/*comment*/{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -375,3 +384,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {} else{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -382,3 +391,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {} else {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -389,3 +398,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {} else\t{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -396,3 +405,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {} else/*comment*/{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -404,3 +413,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'while (true){}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -411,3 +420,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'while (true) {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -418,3 +427,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'while (true)\t{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -425,3 +434,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'while (true)/*comment*/{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -433,3 +442,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'for (;;){}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -440,3 +449,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'for (;;) {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -447,3 +456,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'for (;;)\t{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -454,3 +463,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'for (;;)/*comment*/{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -462,3 +471,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'do{}\nwhile (true);'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -469,3 +478,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'do {}\nwhile (true);'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -476,3 +485,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'do\t{}\nwhile (true);'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -483,3 +492,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'do/*comment*/{}\nwhile (true);'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -491,3 +500,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'struct Student{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -498,3 +507,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'struct Student {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -505,3 +514,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'struct Student\t{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -512,3 +521,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'struct Student/*comment*/{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -520,3 +529,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'with (true){}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -527,3 +536,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'with (true) {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -534,3 +543,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'with (true)\t{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -541,3 +550,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'with (true)/*comment*/{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -549,3 +558,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function foo (uint x) public modif returns (address){}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -556,3 +565,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function foo (uint x) public modif returns (address) {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -563,3 +572,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function foo (uint x) public modif returns (address)\t{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -570,3 +579,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function foo (uint x) public modif returns (address)/*comment*/{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -578,3 +587,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function lotsOfArgs (\n\tuint x,\n\tstring y,\n\taddress z\n){\n\tfoobar ();\n}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -585,3 +594,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function lotsOfArgs (\n\tuint x,\n\tstring y,\n\taddress z\n) {\n\tfoobar ();\n}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -592,3 +601,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function lotsOfArgs (\n\tuint x,\n\tstring y,\n\taddress z\n)\t{\n\tfoobar ();\n}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -599,3 +608,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function lotsOfArgs (\n\tuint x,\n\tstring y,\n\taddress z\n)/*comment*/{\n\tfoobar ();\n}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -612,3 +621,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'function lotsOfArgs ()\n\tpublic\n\treturns (address){\n\tfoobar ();\n}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -619,3 +628,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function lotsOfArgs ()\n\tpublic\n\treturns (address) {\n\tfoobar ();\n}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -626,3 +635,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function lotsOfArgs ()\n\tpublic\n\treturns (address)\t{\n\tfoobar ();\n}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -633,3 +642,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function lotsOfArgs ()\n\tpublic\n\treturns (address) {\n\tfoobar ();\n}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -646,3 +655,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'contract Foo is Bar, Baz\n{}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -653,3 +662,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'library Foo is Bar, Baz\n{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -660,3 +669,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true)\n{} else if (true)\n{} else\n{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -667,3 +676,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'while (true)\n{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -674,3 +683,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'for (;;)\n{}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -681,3 +690,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function increment(uint x) public onlyowner returns (uint)\n{\n\treturn x + 1;\n}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -694,3 +703,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'if (true);', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -701,3 +710,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {}\nelse;'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -708,3 +717,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {} else if (true) {} else;'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -715,3 +724,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {} else if (true);'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -728,3 +737,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'if (true)\nPacman ({\n\tname: "Shannon"\n});', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -735,3 +744,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {}\nelse\nPacman ({\n\tname: "Shannon"\n});'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -742,3 +751,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {} else if (true) {} else\nPacman ({\n\tname: "Shannon"\n});'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -749,3 +758,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {} else if (true)\nPacman ({\n\tname: "Shannon"\n});'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -762,3 +771,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'if (true) sayHello ();', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -769,3 +778,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {}\nelse sayHello();'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -776,3 +785,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {} else if (true) {} else sayHello();'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -783,3 +792,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {} else if (true) sayHello ();'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -796,3 +805,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'if (true) {h();}\nelse if (true) {h();}\nelse {h();}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -803,3 +812,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {h();}\nelse {h();}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -810,3 +819,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {h();}\nelse if (true) {h();}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -817,3 +826,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {h();}\nelse if (true)\nhello ();'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -824,3 +833,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {h();}\nelse if (true)\nhello ();'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -831,3 +840,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {h();}\nelse hello ();'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -834,0 +843,0 @@ errors.constructor.name.should.equal ('Array'); |
@@ -8,4 +8,6 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'); | ||
var wrappers = require ('../../../utils/wrappers'); | ||
var toContract = wrappers.toContract; | ||
var toFunction = wrappers.toFunction; | ||
@@ -35,2 +37,4 @@ var userConfig = { | ||
code = code.map(function(item){return toContract(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -90,2 +94,4 @@ errors.constructor.name.should.equal ('Array'); | ||
code = code.map(function(item){return toContract(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -131,3 +137,3 @@ errors.constructor.name.should.equal ('Array'); | ||
if ('should accept all valid variable declarations', function (done) { | ||
it ('should accept all valid variable declarations', function (done) { | ||
var code = [ | ||
@@ -146,2 +152,4 @@ 'var helloWorld;', | ||
code = code.map(function(item){return toFunction(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -187,3 +195,3 @@ errors.constructor.name.should.equal ('Array'); | ||
if ('should accept all valid declarative expressions', function (done) { | ||
it ('should accept all valid declarative expressions', function (done) { | ||
var code = [ | ||
@@ -202,2 +210,4 @@ 'uint helloWorld;', | ||
code = code.map(function(item){return toContract(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -245,3 +255,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'function foo (helloWorld, h, he, hE, _h, _hE, hello123World, _h123, hello_) {}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -274,2 +284,4 @@ errors.constructor.name.should.equal ('Array'); | ||
code = code.map(function(item){return toContract(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -329,2 +341,4 @@ errors.constructor.name.should.equal ('Array'); | ||
code = code.map(function(item){return toContract(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -384,2 +398,4 @@ errors.constructor.name.should.equal ('Array'); | ||
code = code.map(function(item){return toFunction(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -439,2 +455,4 @@ errors.constructor.name.should.equal ('Array'); | ||
code = code.map(function(item){return toContract(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -482,3 +500,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'function foo (uint _, uint _H, uint Hello, uint HELLOWORLD, uint hello_world, uint __h, uint hello$world, uint $helloWorld) {}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -492,2 +510,2 @@ errors.constructor.name.should.equal ('Array'); | ||
}); | ||
}); |
@@ -8,6 +8,7 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'), | ||
fs = require ('fs'), | ||
path = require ('path'); | ||
var Solium = require ('../../../../lib/solium'); | ||
var wrappers = require ('../../../utils/wrappers'); | ||
var toContract = wrappers.toContract; | ||
var toFunction = wrappers.toFunction; | ||
var addPragma = wrappers.addPragma; | ||
@@ -25,3 +26,3 @@ var userConfig = { | ||
var code = 'contract Foo { event bar (); }', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -32,3 +33,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'library Foo { event bar (); }'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -44,3 +45,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'function foo () { bar (); }', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -56,3 +57,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'function foo () {}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -68,3 +69,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'if (true) { foo (); } else { bar (); }', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -80,3 +81,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'for (i = 0; i < 10; i++) { foo (); }', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -92,3 +93,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'do { foo (); } while (i < 20);', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -104,3 +105,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'while (i < 20) { bar (); }', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -121,3 +122,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'contract Foo {}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -128,3 +129,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'library Foo {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -140,3 +141,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'if (true) {} else {}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -152,3 +153,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'for (i = 0; i < 10; i++) {}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -164,3 +165,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'do {} while (i < 20);', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -176,3 +177,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'while (i < 20) {}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -186,2 +187,2 @@ errors.constructor.name.should.equal ('Array'); | ||
}); | ||
}); |
@@ -8,6 +8,6 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'), | ||
fs = require ('fs'), | ||
path = require ('path'); | ||
var Solium = require ('../../../../lib/solium'); | ||
var wrappers = require ('../../../utils/wrappers'); | ||
var toContract = wrappers.toContract; | ||
var toFunction = wrappers.toFunction; | ||
@@ -34,2 +34,4 @@ var userConfig = { | ||
code = code.map(function(item){return toContract(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -78,2 +80,4 @@ errors.constructor.name.should.equal ('Array'); | ||
code = code.map(function(item){return toFunction(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -107,2 +111,2 @@ errors.constructor.name.should.equal ('Array'); | ||
}); | ||
}); |
@@ -8,6 +8,3 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'), | ||
fs = require ('fs'), | ||
path = require ('path'); | ||
var Solium = require ('../../../../lib/solium'); | ||
@@ -34,2 +31,2 @@ var userConfig = { | ||
}); | ||
}); |
@@ -8,4 +8,6 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'); | ||
var wrappers = require ('../../../utils/wrappers') | ||
var toFunction = wrappers.toFunction; | ||
var userConfig = { | ||
@@ -43,2 +45,4 @@ "custom-rules-filename": null, | ||
code = code.map(function(item){return toFunction(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -146,2 +150,4 @@ errors.constructor.name.should.equal ('Array'); | ||
code = code.map(function(item){return toFunction(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -215,2 +221,2 @@ errors.constructor.name.should.equal ('Array'); | ||
}); | ||
}); |
@@ -8,6 +8,3 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'), | ||
fs = require ('fs'), | ||
path = require ('path'); | ||
var Solium = require ('../../../../lib/solium'); | ||
@@ -86,2 +83,2 @@ var userConfig = { | ||
}); | ||
}); |
@@ -8,6 +8,5 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'), | ||
fs = require ('fs'), | ||
path = require ('path'); | ||
var Solium = require ('../../../../lib/solium'); | ||
var wrappers = require ('../../../utils/wrappers'); | ||
var toContract = wrappers.toContract; | ||
@@ -32,2 +31,4 @@ var userConfig = { | ||
code = code.map(function(item){return toContract(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -69,2 +70,4 @@ errors.constructor.name.should.equal ('Array'); | ||
code = code.map(function(item){return toContract(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -98,2 +101,2 @@ errors.constructor.name.should.equal ('Array'); | ||
}); | ||
}); |
@@ -8,6 +8,5 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'), | ||
fs = require ('fs'), | ||
path = require ('path'); | ||
var Solium = require ('../../../../lib/solium'); | ||
var wrappers = require ('../../../utils/wrappers'); | ||
var toFunction = wrappers.toFunction; | ||
@@ -33,2 +32,4 @@ var userConfig = { | ||
code = code.map(function(item){return toFunction(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -58,2 +59,2 @@ errors.constructor.name.should.equal ('Array'); | ||
}); | ||
}); |
@@ -8,6 +8,7 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../../../lib/solium'), | ||
fs = require ('fs'), | ||
path = require ('path'); | ||
var Solium = require ('../../../../lib/solium'); | ||
var wrappers = require ('../../../utils/wrappers'); | ||
var toContract = wrappers.toContract; | ||
var toFunction = wrappers.toFunction; | ||
var addPragma = wrappers.addPragma; | ||
@@ -25,3 +26,3 @@ var userConfig = { | ||
var code = 'func ();', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -32,3 +33,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'foo.func ();'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -44,3 +45,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'spam(ham[1], Coin({name: "ham"}));', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -51,3 +52,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'foo.bar (10, 20, 30);'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -58,3 +59,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'foo.bar (10, 20, 30);'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -65,3 +66,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'foo (10, 20).func ();'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -72,3 +73,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'foo ["func ()"] ();'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -79,3 +80,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'foo ["func (10, 20)"] ();'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -91,3 +92,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'function singleLine() { spam(); }', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -99,3 +100,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function singleLine() {spam();}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -111,3 +112,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'function spam(uint i, Coin coin);', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -118,3 +119,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'var foobar = "Hello World";'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -125,3 +126,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'fooBar (baz ({\nhello: "world"\n}));'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -132,3 +133,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function foo (uint x, string y);'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -144,3 +145,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'x = 100; y = "hello world"; string exa = "bytes";', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -150,4 +151,4 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'x += 100; y *= 10; z -= 10;'; | ||
errors = Solium.lint (code, userConfig); | ||
code = 'x += 100; y *= 10; z -= 10; f /= 100; p |= akjh; ufx ^= 10.289; jack &= jones; p <<= 78; c >>= 100; perc %= 0;'; | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -158,3 +159,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'var x = 100;'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -165,3 +166,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'var (x, y, z) = (10, 20, 30);'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -172,3 +173,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'var (x, y, z) = fooBar ();'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -178,2 +179,8 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'uint newNumber = (10 * 78 + 982 % 6**2);'; | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (0); | ||
Solium.reset (); | ||
@@ -185,3 +192,3 @@ done (); | ||
var code = 'call ();', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -192,3 +199,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'call ({});'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -199,3 +206,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = '[];'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -206,3 +213,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function foo () {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -213,3 +220,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'if (true) {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -230,3 +237,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'func ( );', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -237,3 +244,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'func (\t);'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -244,3 +251,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'func (\n);'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -251,3 +258,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'func (/**/);'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -258,3 +265,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'foo ["func ()"] ( );'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -265,3 +272,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'foo ().func (\t);'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -277,3 +284,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'spam( ham[ 1 ], Coin( { name: "ham" } ) );', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -284,3 +291,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'ham[/**/"1"/**/];'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -291,3 +298,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'ham[\t"1"\t];'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -306,3 +313,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'function spam(uint i , Coin coin) ;', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -313,3 +320,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'var foobar = 100 ;' | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -320,3 +327,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'var foobar = 100\n;' | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -327,3 +334,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'var foobar = 100\t;' | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -334,3 +341,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'var foobar = 100/*abc*/;' | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -341,3 +348,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function foo (uint x, string y) ;'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -348,3 +355,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function foo (uint x, string y)\t;'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -355,3 +362,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function foo (uint x, string y)\n;'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -362,3 +369,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'function foo (uint x, string y)/*abc*/;'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -369,3 +376,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'x [0] = fooBar () ;'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -376,3 +383,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'x [0] = fooBar ()/**/;'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -383,3 +390,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'import * as C from "chuh"/**/;'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (addPragma(code), userConfig); | ||
@@ -390,3 +397,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'using Foo for *\t;'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -397,3 +404,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'using Foo for Bar.baz\t;'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toContract(code), userConfig); | ||
@@ -409,3 +416,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = '[1 , 2, 3 , 4,5];', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -416,3 +423,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'call (10\t, 20, 30 ,40,50);', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -423,3 +430,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'call ({name: "foo"\n, age: 20,id: 1 ,dept: "math"})', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -430,3 +437,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = '(1 ,2\t,3\n,4);', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -463,2 +470,4 @@ errors.constructor.name.should.equal ('Array'); | ||
code = code.map(function(item){return toFunction(item)}); | ||
errors = Solium.lint (code [0], userConfig); | ||
@@ -474,3 +483,3 @@ errors.constructor.name.should.equal ('Array'); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (2); | ||
errors.length.should.equal (1); | ||
@@ -483,3 +492,3 @@ errors = Solium.lint (code [3], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (2); | ||
errors.length.should.equal (1); | ||
@@ -492,3 +501,3 @@ errors = Solium.lint (code [5], userConfig); | ||
errors.constructor.name.should.equal ('Array'); | ||
errors.length.should.equal (2); | ||
errors.length.should.equal (1); | ||
@@ -508,3 +517,3 @@ errors = Solium.lint (code [7], userConfig); | ||
code = 'var x\n=\n"hello world";' | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -515,3 +524,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'var x\t=\t"hello world";' | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -522,3 +531,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'var x = /*abc*/"hello world";' | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -529,3 +538,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'var x =/*abc*/ "hello world";' | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -536,3 +545,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'var x/*abc*/ = "hello world";' | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -543,3 +552,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'var x /*abc*/= "hello world";' | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -555,3 +564,3 @@ errors.constructor.name.should.equal ('Array'); | ||
var code = 'if(true) {}\nelse if(true) {}', | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -562,3 +571,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'for(;;) {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -569,3 +578,3 @@ errors.constructor.name.should.equal ('Array'); | ||
code = 'while(true) {}'; | ||
errors = Solium.lint (code, userConfig); | ||
errors = Solium.lint (toFunction(code), userConfig); | ||
@@ -579,2 +588,2 @@ errors.constructor.name.should.equal ('Array'); | ||
}); | ||
}); |
@@ -8,3 +8,2 @@ /** | ||
var should = require ('should'); | ||
var Solium = require ('../../lib/solium'), | ||
@@ -303,2 +302,2 @@ EventEmitter = require ('events').EventEmitter; | ||
}); | ||
}); |
@@ -8,3 +8,2 @@ /** | ||
var should = require ('should'); | ||
var astUtils = require ('../../../lib/utils/ast-utils'); | ||
@@ -85,3 +84,3 @@ | ||
it ('should correctly classify argument as AST Node or non-AST Node upon calling isASTNode ()', function (done) { | ||
var ian = astUtils.isASTNode, temp; | ||
var ian = astUtils.isASTNode; | ||
@@ -298,2 +297,2 @@ ian ().should.equal (false); | ||
}); | ||
}); |
@@ -8,4 +8,4 @@ /** | ||
var should = require ('should'); | ||
var jsUtils = require ('../../../lib/utils/js-utils'); | ||
var Solium = require ('../../../lib/solium'), | ||
jsUtils = require('../../../lib/utils/js-utils'); | ||
@@ -21,3 +21,3 @@ describe ('Test jsUtils functions', function () { | ||
it ('should correctly classify whether argument is a non-array, non-null object', function (done) { | ||
it ('isStrictlyObject: should correctly classify whether argument is a non-array, non-null object', function (done) { | ||
var iso = jsUtils.isStrictlyObject; | ||
@@ -35,3 +35,2 @@ | ||
}); | ||
}); | ||
}); |
@@ -8,3 +8,2 @@ /** | ||
var should = require ('should'); | ||
var EventGenerator = require ('../../../lib/utils/node-event-generator'), | ||
@@ -58,2 +57,2 @@ Solium = require ('../../../lib/solium'); | ||
}); | ||
}); |
@@ -8,5 +8,3 @@ /** | ||
var should = require ('should'); | ||
var SourceCode = require ('../../../lib/utils/source-code-utils'), | ||
Solium = require ('../../../lib/solium'); | ||
var SourceCode = require ('../../../lib/utils/source-code-utils'); | ||
@@ -274,2 +272,2 @@ describe ('Testing SourceCode instance for exposed functionality', function () { | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
252411
76
6212
153
8
5