Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from Decurity/constant-not-in-uppercase
Adding the constant-not-in-uppercase rule
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
contract Test { | ||
// ruleid: constant-not-in-uppercase | ||
uint8 constant test = 1337; | ||
// ruleid: constant-not-in-uppercase | ||
string constant Test = "kekeke"; | ||
// ruleid: constant-not-in-uppercase | ||
bytes internal constant aTEST = hex"616161"; | ||
// ok: constant-not-in-uppercase | ||
uint256 constant TEST = 31338; | ||
// ok: constant-not-in-uppercase | ||
int64 constant THE_TEST = 123; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
rules: | ||
- id: constant-not-in-uppercase | ||
message: A constant name is not in UPPER_CASE like other constant variables. | ||
languages: | ||
- solidity | ||
severity: WARNING | ||
metadata: | ||
category: coding-style | ||
tags: | ||
- compound | ||
references: | ||
- https://github.com/compound-finance/comet/issues/396 | ||
patterns: | ||
- metavariable-regex: | ||
metavariable: $NAME | ||
regex: ".*[a-z].*" | ||
- pattern: | | ||
$TYPE constant $NAME = ...; |