Package Exports
- solium
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (solium) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Solium analyzes your Solidity code for style & security issues and fixes them.
Standardize Smart Contract practices across your organisation. Integrate with your build system. Deploy with confidence!
Install
npm install -g solium
solium -VUsage
In the root directory of your DApp:
solium --initThis creates 2 files for you:
.soliumignore- contains names of files and directories to ignore while linting.soliumrc.json- contains configuration that tells Solium how to lint your project. You should modify this file to configure rules, plugins and sharable configs.
.soliumrc.json looks like:
{
"extends": "solium:recommended",
"plugins": ["security"],
"rules": {
"quotes": ["error", "double"],
"indentation": ["error", 4]
}
}To know which lint rules Solium applies for you, see Style rules and Security rules.
NOTE
Solium does not strictly adhere to Solidity Style Guide. It aims to promote coding practices agreed upon by the community at large.
Lint
solium -f foobar.sol
solium -d contracts/Configure with comments
Comment Directives can be used to configure Solium to ignore specific pieces of code.
They follow the pattern solium-disable<optional suffix>.
If you only use the directive, Solium disables all rules for the marked code. If that's not desirable, specify the rules to disable after the directive, separated by comma.
- Disable linting on a specific line
contract Foo {
/* solium-disable-next-line */
function() {
var bar = 'Hello world'; // solium-disable-line quotes
// solium-disable-next-line security/no-throw, indentation
throw;
}
}- Disable linting on entire file
/* solium-disable */
contract Foo {
...
}Fix
Solium automatically fixes your code to resolve whatever issues it can.
solium -d contracts --fix