Skip to content

Commit 0c05a45

Browse files
Merge pull request #619 from protofire/develop
Merge Develop to Master v5.0.4
2 parents 307fe6b + 2bf186f commit 0c05a45

File tree

155 files changed

+947
-719
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+947
-719
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: PRE-COMMIT
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- develop
8+
tags:
9+
- '*'
10+
pull_request:
11+
paths:
12+
- .github/workflows/PRE-COMMIT-HOOK-TEST.yml
13+
- .pre-commit-hooks.yaml
14+
- e2e/pre-commit-hook/*
15+
- package.json
16+
17+
jobs:
18+
hook-test:
19+
runs-on: ubuntu-latest
20+
name: Test Hook
21+
steps:
22+
- uses: actions/checkout@v4
23+
- uses: actions/setup-node@v4
24+
with:
25+
node-version: 20
26+
- uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.12'
29+
- name: Install pre-commit
30+
run: |
31+
python -m pip install pre-commit
32+
- name: Test hooks
33+
run: |
34+
./e2e/pre-commit-hook/test.sh

.husky/pre-commit

Lines changed: 0 additions & 4 deletions
This file was deleted.

.pre-commit-hooks.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- id: solhint
2+
name: solhint
3+
description: Lint Solidity files with Solhint
4+
entry: solhint
5+
types: ["solidity"]
6+
language: node

CHANGELOG.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
1+
## [5.0.4] - 2024-12-31
2+
### Fixed
3+
- `imports-order` [#595](https://github.com/protofire/solhint/pull/595) - Replaced single quotes with double quotes
4+
- `gas-custom-errors` [#613](https://github.com/protofire/solhint/pull/613) - Allows the use of Requirement with Custom Errors
5+
- Typos and broken links [#611](https://github.com/protofire/solhint/pull/611) - [#617](https://github.com/protofire/solhint/pull/617)
6+
- Upgraded `solidity-parser` dependency [#612](https://github.com/protofire/solhint/pull/612)
7+
8+
9+
### Added
10+
- `.pre-commit-hooks.yaml` to allow projects to run Solhint via pre-commit [#596](https://github.com/protofire/solhint/pull/596) (Thanks to [@dbast](https://github.com/dbast))
11+
- Removed `husky` since it is not needed [#612](https://github.com/protofire/solhint/pull/612)
12+
13+
<br><br>
14+
15+
116
## [5.0.3] - 2024-08-03
217
### Fixed
3-
- New Rule: Imports order [#593](https://github.com/protofire/solhint/pull/593)
18+
- `imports-order` [#593](https://github.com/protofire/solhint/pull/593)
419

520
<br><br>
621

@@ -16,10 +31,11 @@
1631

1732
## [5.0.1] - 2024-05-13
1833
### BREAKING CHANGES (refer to v5.0.0)
19-
Fixed an issue on the returining values where only was evaluating the first report instead of all of them.
34+
Fixed an issue on the returning values where only was evaluating the first report instead of all of them.
2035

2136

2237
<br><br>
38+
2339
## [5.0.0] - 2024-05-11
2440
### BREAKING CHANGES
2541

@@ -37,6 +53,7 @@ QUIET mode (-c quiet) option now works with the warnings and may exit with 1 if
3753
Thanks to [@juanpcapurro](https://github.com/juanpcapurro) for providing the code
3854

3955
<br><br>
56+
4057
## [4.5.4] - 2024-04-10
4158
### Fixed
4259
- `gas-custom-errors` improved logic to ranged pragma versions [#573](https://github.com/protofire/solhint/pull/573)
@@ -68,7 +85,7 @@ Thanks to [@juanpcapurro](https://github.com/juanpcapurro) for providing the cod
6885
- New Rule: Interface starts with `i` [#557](https://github.com/protofire/solhint/pull/557)
6986

7087
#### Gas Consumption Rules
71-
- New Rule: [GC] Mutlitoken1155 rule [#541](https://github.com/protofire/solhint/pull/541)
88+
- New Rule: [GC] Multitoken1155 rule [#541](https://github.com/protofire/solhint/pull/541)
7289
- New Rule: [GC] Small strings check [#542](https://github.com/protofire/solhint/pull/542)
7390
- New Rule: [GC] Indexed events [#543](https://github.com/protofire/solhint/pull/543)
7491
- New Rule: [GC] Calldata parameters [#544](https://github.com/protofire/solhint/pull/544)
@@ -153,7 +170,7 @@ Thanks to [@juanpcapurro](https://github.com/juanpcapurro) for providing the cod
153170

154171
### Fixed
155172
- `foundry-test-functions` - Modified regex to include invariant and statefulFuzz tests [#484](https://github.com/protofire/solhint/pull/484)
156-
- `quotes` - To allow quotes inside double quotes and viceversa [#485](https://github.com/protofire/solhint/pull/485)
173+
- `quotes` - To allow quotes inside double quotes and vice versa [#485](https://github.com/protofire/solhint/pull/485)
157174
- `JSON` - Formatter returning JS object instead of standard json [#490](https://github.com/protofire/solhint/pull/490)
158175

159176

DEV-README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Setting up Git Hooks
2+
3+
After cloning the repository, set up the pre-commit hook by running the following commands:
4+
5+
`git config --unset core.hooksPath`
6+
To reset the hooks config to git default
7+
8+
```sh
9+
touch .git/hooks/pre-commit
10+
chmod +x .git/hooks/pre-commit
11+
echo '#!/bin/sh\nnode scripts/check-changes.js' > .git/hooks/pre-commit

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="center">
2-
<a href="https://protofire.io/projects/solhint" target="_blank"><img src="solhint.png"></a>
2+
<a href="https://protofire.io/solhint" target="_blank"><img src="solhint.png"></a>
33
</p>
44
<p align="center">
55
By <a href="https://protofire.io/" target="_blank">Protofire</a>
@@ -16,7 +16,7 @@ https://coveralls.io/github/protofire/solhint?branch=master)
1616
This is an open source project for linting [Solidity](http://solidity.readthedocs.io/en/develop/) code. This project
1717
provides both **Security** and **Style Guide** validations.
1818
<br>
19-
[VISIT OUR WEBSITE](https://protofire.io/projects/solhint)<br>
19+
[VISIT OUR WEBSITE](https://protofire.io/solhint)<br>
2020
[JOIN OUR DISCORD SERVER](https://discord.gg/4TYGq3zpjs)
2121
<br>
2222
## Installation
@@ -204,12 +204,24 @@ Or disable all validations for a group of lines:
204204
### Style Guide Rules
205205
[Full list with all supported Style Guide Rules](docs/rules.md#style-guide-rules)
206206
### Best Practices Rules
207-
[Full list with all supported Best Practices Rules](docs/rules.md#best-practise-rules)
207+
[Full list with all supported Best Practices Rules](docs/rules.md#best-practices-rules)
208208

209209
## Docker
210210
### Solhint has an official Docker Image
211211
Go to docker folder and follow [this](docker/docker.md) instructions.
212212

213+
## pre-commit
214+
### Solhint can also be used as [pre-commit](https://pre-commit.com/) hook
215+
216+
Replace `$GIT_TAG` with real tag:
217+
218+
```YAML
219+
- repo: https://github.com/protofire/solhint
220+
rev: $GIT_TAG
221+
hooks:
222+
- id: solhint
223+
```
224+
213225
## Documentation
214226
Related documentation you may find [here](https://protofire.github.io/solhint/).
215227
@@ -257,7 +269,7 @@ Related documentation you may find [here](https://protofire.github.io/solhint/).
257269
258270
The Solidity parser used is [`@solidity-parser/parser`](https://github.com/solidity-parser/parser).
259271

260-
## Licence
272+
## License
261273

262274
MIT
263275

conf/rulesets/solhint-all.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ module.exports = Object.freeze({
3838
'comprehensive-interface': 'warn',
3939
quotes: ['error', 'double'],
4040
'const-name-snakecase': 'warn',
41-
'contract-name-camelcase': 'warn',
42-
'event-name-camelcase': 'warn',
41+
'contract-name-capwords': 'warn',
42+
'event-name-capwords': 'warn',
4343
'foundry-test-functions': ['warn', ['setUp']],
4444
'func-name-mixedcase': 'warn',
4545
'func-named-parameters': ['warn', 4],

conf/rulesets/solhint-recommended.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ module.exports = Object.freeze({
2323
'gas-custom-errors': 'warn',
2424
quotes: ['error', 'double'],
2525
'const-name-snakecase': 'warn',
26-
'contract-name-camelcase': 'warn',
27-
'event-name-camelcase': 'warn',
26+
'contract-name-capwords': 'warn',
27+
'event-name-capwords': 'warn',
2828
'func-name-mixedcase': 'warn',
2929
'immutable-vars-naming': [
3030
'warn',

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM node:20-alpine
22
LABEL maintainer="diego.bale@protofire.io"
3-
ENV VERSION=5.0.3
3+
ENV VERSION=5.0.4
44

55
RUN npm install -g solhint@"$VERSION"

docs/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Solhint Configuration
44
date: 2017-10-23 14:16:00 +0300
55
author: "@drabenia"
66
description: Configuration of solidity security and style guide verification,
7-
best practise validations.
7+
best practice validations.
88
---
99

1010
### Configuration

0 commit comments

Comments
 (0)