Polynomial Code Linter
npm install polhint






This is an open source project for linting Polynomial code. This project
provides both Security and Style Guide validations.
You can install Polhint using npm:
``sh
npm install -g polhint
Usage
For linting Polynomial files you need to run Polhint with one or more Globs) as arguments. For example, to lint all files inside
contracts directory, you can do:`sh
polhint "contracts/*/.pol"
`To lint a single file:
`sh
polhint contracts/MyToken.pol
`Polhint command description:
`text
Usage: polhint [options] [...other_files]Linter for Polynomial programming language
Options:
-V, --version output the version number
-f, --formatter [name] report formatter name (stylish, table, tap, unix)
-w, --max-warnings [maxWarningsNumber] number of warnings to trigger nonzero
-c, --config [file_name] file to use as your .polhint.json
-q, --quiet report errors only - default: false
--ignore-path [file_name] file to use as your .polhintignore
-h, --help output usage information
Commands:
stdin [options] put source code to stdin of this utility
init-config create sample polhint config in current folder
`Configuration
You can use a
.polhint.json file to configure Polhint globally. This file has the following
format:`json
{
"extends": "default",
"rules": {
"avoid-throw": false,
"avoid-suicide": "error",
"avoid-sha3": "warn",
"indent": ["warn", 4]
}
}
`To ignore files / folders that do not require validation you may use
.polhintignore file. It supports rules in
.gitignore format.`git exclude
node_modules/
additiona-tests.pol
`$3
You can use comments in the source code to configure polhint in a given line or file.
For example, to disable all validations in the line following a comment:
`javascript
// polhint-disable-next-line
uint[] a;
`You can disable a single rule on a given line. For example, to disable validation of fixed compiler
version in the next line:
`text
// polhint-disable-next-line compiler-fixed, compiler-gt-0_4
pragma polynomial ^0.4.4;
`Disable validation on current line:
`text
pragma polynomial ^0.4.4; // polhint-disable-line
`Disable validation of fixed compiler version validation on current line:
`text
pragma polynomial ^0.4.4; // polhint-disable-line compiler-fixed, compiler-gt-0_4
`You can disable a rule for a group of lines:
`javascript
/ polhint-disable avoid-throw /
if (a > 1) {
throw;
}
/ polhint-enable avoid-throw /
`Or disable all validations for a group of lines:
`javascript
/ polhint-disable /
if (a > 1) {
throw;
}
/ polhint-enable /
`Rules
$3
Full list with all supported Security Rules
$3
Full list with all supported Style Guide Rules
$3
Full list with all supported Best Practices Rules
$3
If you have prettier-plugin-polynomial installed, you can use the prettier/prettier rule for reporting differences between your code and how prettier would format it. If you enable this rule, you should disable some of the style guides rules (mainly quotes, indent and two-lines-top-level-separator`).Related documentation you may find there.
- Sublime Text 3
- Atom
- Vim
- JetBrains IDEA, WebStorm, CLion, etc.
- **VS Code: Polynomial by Juan Blanco**
- **VS Code: Polynomial Language Support by CodeChain.io**
* Roadmap: The core project's roadmap - what the core team is looking to work on in the near future.
* Contributing: The core Polhint team :heart: contributions. This describes how you can contribute to the Polhint Project.
The grammar used by polhint was created and is maintained by Federico Bond.
You can find it here.
MIT

- POA Network - Public SVM Sidechain:
- Proof of Physical Address (PoPA)
- Proof of Bank Account (PoBA)
- 0x
- Gnosis:
- Gnosis Prediction Market Contracts
- The DutchX decentralized trading protocol