You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+16Lines changed: 16 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,19 @@
1
+
## [5.2.0] - 2025-06-27
2
+
### Fixed
3
+
-`imports-order` interference with `no-unused-imports`[#684](https://github.com/protofire/solhint/pull/684)
4
+
5
+
### Added
6
+
- Added `cache` flag allowing to skip already evaluated files if no error was thrown and file did not change - [#685](https://github.com/protofire/solhint/pull/685)
7
+
- Added multi-directory config support by hierarchy - [#678](https://github.com/protofire/solhint/pull/678)
8
+
- Added better error handling on invalid configs - [#683](https://github.com/protofire/solhint/pull/683)
9
+
10
+
11
+
Thanks to [@smol-ninja](https://github.com/smol-ninja) - [@PaulRBerg](https://github.com/PaulRBerg)[@lechpzn](https://github.com/lechpzn), [@otc-png](https://github.com/otc-png), [@MamunC0der](https://github.com/MamunC0der), [@kks-code](https://github.com/kks-code), [@RidaMichofi](https://github.com/RidaMichofi)
12
+
13
+
For making the time of proposing rules, pointing out typos, broken links, unused code, copyright, small reviews, etc. We really appreciate your contributions!
14
+
15
+
<br><br>
16
+
1
17
## [5.1.0] - 2025-05-05
2
18
### Added
3
19
- Argument to avoid discord poster - [#646](https://github.com/protofire/solhint/pull/646)
-w, --max-warnings [maxWarningsNumber] number of allowed warnings, works in quiet mode as well
65
-
-c, --config [file_name] file to use as your .solhint.json
65
+
-c, --config [file_name] file to use as your rules configuration file (not compatible with multiple configs)
66
66
-q, --quiet report errors only - default: false
67
67
--ignore-path [file_name] file to use as your .solhintignore
68
68
--fix automatically fix problems and show report
69
+
--cache only lint files that changed since last run
70
+
--cache-location path to the cache file
69
71
--noPrompt do not suggest to backup files when any `fix` option is selected
70
72
--init create configuration file for solhint
71
73
--disc do not check for solhint updates
72
74
--save save report to file on current folder
75
+
--noPoster remove discord poster
73
76
-h, --help output usage information
74
77
75
78
Commands:
@@ -98,7 +101,7 @@ This option currently works on:
98
101
99
102
You can use a `.solhint.json` file to configure Solhint for the whole project.
100
103
101
-
To generate a new sample `.solhint.json` file in current folder you can do:
104
+
To generate a new sample `.solhint.json` file in current folder you can do:
102
105
103
106
```sh
104
107
solhint --init
@@ -111,9 +114,37 @@ This file has the following format:
111
114
"extends": "solhint:recommended"
112
115
}
113
116
```
114
-
### Note
117
+
### Note 1
115
118
The `solhint:default` configuration contains only two rules: max-line-length & no-console
116
119
It is now deprecated since version 5.1.0
120
+
<br>
121
+
122
+
### Note 2
123
+
Multiple configs files can be used at once. All config files should be named `.solhint.json`.
124
+
If not done like this, multiple hierarchy configuration will not work.
125
+
Solhint will go though all config files automatically.
126
+
127
+
Given this structure:
128
+
```
129
+
Project ROOT =>
130
+
/contracts
131
+
---> RootAndContractRules.sol
132
+
---> .solhint.json
133
+
134
+
/src
135
+
--->RootRules.sol
136
+
--->interfaces/
137
+
------->InterfaceRules.sol
138
+
------->solhint.json
139
+
140
+
.solhint.json
141
+
```
142
+
- Solhint config located on `root` will be the main one.
143
+
- When analyzing `RootRules.sol`, `root` file config will be used that file.
144
+
-`InterfaceRules.sol` will be using the one inside its own folder taking precedence over the `root` folder one.
145
+
- Rules not present in `interfaces/` folder and present in `root` will be active.
146
+
- Rules not present in `root` folder and present in `interfaces/` folder will be active.
147
+
- If rule is present in both files, the closest to the analyzed file will take precedence. Meaning when analyzing `InterfaceRules.sol` the config file located in `Interfaces/` will be used with the remaining rules of the `root` one.
117
148
<br><br>
118
149
119
150
@@ -138,6 +169,25 @@ node_modules/
138
169
additional-tests.sol
139
170
```
140
171
172
+
### Cache
173
+
Solhint supports a caching mechanism using the `--cache` flag to avoid re-linting files that haven't changed.
174
+
When enabled, Solhint stores a hash of each file's content and effective configuration, skipping analysis if neither has changed.
175
+
By default, the cache is saved in `.solhintcache.json` in the current working directory.
176
+
You can customize this location using the `--cache-location option`. If no location is specified, the file will be stored in:
177
+
`node_modules/.cache/solhint/.solhint-cache.json`
178
+
179
+
Warning:
180
+
When using `cache` flag. If a file was analyzed with not error for a certain config, the hash will be stored. If the file is not changed but the config file (`.solhint.json`) has some new rules, the file will not be analyzed.
|[code-complexity](./rules/best-practices/code-complexity.md)| Function has cyclomatic complexity "current" but allowed no more than maxcompl. |||
11
+
|[code-complexity](./rules/best-practices/code-complexity.md)| Function has cyclomatic complexity "current" but allowed no more than configured max complexity.|||
12
12
|[explicit-types](./rules/best-practices/explicit-types.md)| Forbid or enforce explicit types (like uint256) that have an alias (like uint). | $~~~~~~~~$✔️ ||
13
13
|[function-max-lines](./rules/best-practices/function-max-lines.md)| Function body contains "count" lines but allowed no more than maxlines. |||
14
-
|[max-line-length](./rules/best-practices/max-line-length.md)| Line length must be no more than maxlen. |||
15
-
|[max-states-count](./rules/best-practices/max-states-count.md)| Contract has "some count" states declarations but allowed no more than maxstates. | $~~~~~~~~$✔️ ||
14
+
|[max-line-length](./rules/best-practices/max-line-length.md)| Line length should not exceed configured number of characters.|||
15
+
|[max-states-count](./rules/best-practices/max-states-count.md)| Contract has "some count" states declarations but allowed no more than defined max states.| $~~~~~~~~$✔️ ||
16
16
|[no-console](./rules/best-practices/no-console.md)| No console.log/logInt/logBytesX/logString/etc & No hardhat and forge-std console.sol import statements. | $~~~~~~~~$✔️ ||
17
17
|[no-empty-blocks](./rules/best-practices/no-empty-blocks.md)| Code block has zero statements inside. Exceptions apply. | $~~~~~~~~$✔️ ||
18
18
|[no-global-import](./rules/best-practices/no-global-import.md)| Import statement includes an entire file instead of selected symbols. | $~~~~~~~~$✔️ ||
@@ -42,7 +42,7 @@ title: "Rule Index of Solhint"
42
42
|[named-parameters-mapping](./rules/naming/named-parameters-mapping.md)| Solidity v0.8.18 introduced named parameters on the mappings definition. |||
43
43
|[private-vars-leading-underscore](./rules/naming/private-vars-leading-underscore.md)| Non-external functions and state variables should start with a single underscore. Others, shouldn't |||
44
44
|[use-forbidden-name](./rules/naming/use-forbidden-name.md)| Avoid to use letters 'I', 'l', 'O' as identifiers. | $~~~~~~~~$✔️ ||
45
-
|[var-name-mixedcase](./rules/naming/var-name-mixedcase.md)| Variable names must be in mixedCase. (Does not check IMMUTABLES, use immutable-vars-naming) | $~~~~~~~~$✔️ ||
45
+
|[var-name-mixedcase](./rules/naming/var-name-mixedcase.md)| Variable names must be in mixedCase. (Does not check IMMUTABLES nor CONSTANTS (use inherent rules for that)| $~~~~~~~~$✔️ ||
46
46
|[imports-on-top](./rules/order/imports-on-top.md)| Import statements must be on top. | $~~~~~~~~$✔️ ||
47
47
|[imports-order](./rules/naming/imports-order.md)| Order the imports of the contract to follow a certain hierarchy (read "Notes section") |||
48
48
|[ordering](./rules/order/ordering.md)| Check order of elements in file and inside each contract, according to the style guide |||
@@ -85,7 +85,7 @@ title: "Rule Index of Solhint"
85
85
|[avoid-throw](./rules/security/avoid-throw.md)| "throw" is deprecated, avoid to use it. | $~~~~~~~~$✔️ ||
86
86
|[avoid-tx-origin](./rules/security/avoid-tx-origin.md)| Avoid to use tx.origin. | $~~~~~~~~$✔️ ||
87
87
|[check-send-result](./rules/security/check-send-result.md)| Check result of "send" call. | $~~~~~~~~$✔️ ||
88
-
|[compiler-version](./rules/security/compiler-version.md)| Compiler version must satisfy a semver requirement. | $~~~~~~~~$✔️ ||
88
+
|[compiler-version](./rules/security/compiler-version.md)| Compiler version must satisfy a semver requirement at least ^0.8.24.| $~~~~~~~~$✔️ ||
89
89
|[func-visibility](./rules/security/func-visibility.md)| Explicitly mark visibility in function. | $~~~~~~~~$✔️ ||
90
90
|[multiple-sends](./rules/security/multiple-sends.md)| Avoid multiple calls of "send" method in single transaction. | $~~~~~~~~$✔️ ||
91
91
|[no-complex-fallback](./rules/security/no-complex-fallback.md)| Fallback function must be simple. | $~~~~~~~~$✔️ ||
0 commit comments