solhint 规则列表

xiaoxiao2021-02-28  72

Security Rules

Rule IDErrorOptionsreentrancyPossible reentrancy vulnerabilities. Avoid state changes after transfer.defaultavoid-sha3Use “keccak256” instead of deprecated “sha3”defaultavoid-suicideUse “selfdestruct” instead of deprecated “suicide”defaultavoid-throw“throw” is deprecated, avoid to use itdefaultfunc-visibilityExplicitly mark visibility in functiondefaultstate-visibilityExplicitly mark visibility of statedefaultcheck-send-resultCheck result of “send” calldefaultavoid-call-valueAvoid to use “.call.value()()”defaultcompiler-fixedCompiler version must be fixeddefaultcompiler-gt-0_4Use at least ‘0.4’ compiler versiondefaultno-complex-fallbackFallback function must be simpledefaultmark-callable-contractsExplicitly mark all external contracts as trusted or untrusteddefaultmultiple-sendsAvoid multiple calls of “send” method in single transactiondefaultno-simple-event-func-nameEvent and function names must be differentdefaultavoid-tx-originAvoid to use tx.origindefaultno-inline-assemblyAvoid to use inline assembly. It is acceptable only in rare casesdefaultnot-rely-on-block-hashDo not rely on “block.blockhash”. Miners can influence its value.defaultavoid-low-level-callsAvoid to use low level calls.default

* - All security rules implemented according ConsenSys Guide for Smart Contracts

Style Guide Rules

Rule IDErrorOptionsfunc-name-mixedcaseFunction name must be in camelCasedefaultfunc-param-name-mixedcaseFunction param name must be in mixedCasedefaultvar-name-mixedcaseVariable name must be in mixedCasedefaultevent-name-camelcaseEvent name must be in CamelCasedefaultconst-name-snakecaseConstant name must be in capitalized SNAKE_CASEdefaultmodifier-name-mixedcaseModifier name must be in mixedCasedefaultcontract-name-camelcaseContract name must be in CamelCasedefaultuse-forbidden-nameAvoid to use letters ‘I’, ‘l’, ‘O’ as identifiersdefaultvisibility-modifier-orderVisibility modifier must be first in list of modifiersdefaultimports-on-topImport statements must be on topdefaulttwo-lines-top-level-separatorDefinition must be surrounded with two blank line indentdefaultfunc-orderFunction order is incorrectdefaultquotesUse double quotes for string literals. Default quotes values is “double”. Values must be ‘single’ or ‘double’.[\<default>, \<quotes>]no-mix-tabs-and-spacesMixed tabs and spacesdefaultindentIndentation is incorrect[\<default>, \

Best Practise Rules

Rule IDErrorOptionsmax-line-lengthLine length must be no more than maxlen.[\<default>, \] Default maxlen is 120.payable-fallbackWhen fallback is not payable you will not be able to receive ethersdefaultno-empty-blocksCode contains empty blockdefaultno-unused-varsVariable “name” is unuseddefaultfunction-max-linesFunction body contains “count” lines but allowed no more than maxlines.[\<default>, \] Default maxlines is 45.code-complexityFunction has cyclomatic complexity “current” but allowed no more than maxcompl.[\<default>, \] Default maxcompl is 7.max-states-countContract has “some count” states declarations but allowed no more than maxstates[\<default>, \] Default maxstates is 15.