Skip to content

Commit

Permalink
Merge pull request #619 from protofire/develop
Browse files Browse the repository at this point in the history
Merge Develop to Master v5.0.4
  • Loading branch information
dbale-altoros authored Dec 31, 2024
2 parents 307fe6b + 2bf186f commit 0c05a45
Show file tree
Hide file tree
Showing 155 changed files with 947 additions and 719 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/PRE-COMMIT-HOOK-TEST.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: PRE-COMMIT

on:
push:
branches:
- master
- develop
tags:
- '*'
pull_request:
paths:
- .github/workflows/PRE-COMMIT-HOOK-TEST.yml
- .pre-commit-hooks.yaml
- e2e/pre-commit-hook/*
- package.json

jobs:
hook-test:
runs-on: ubuntu-latest
name: Test Hook
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install pre-commit
run: |
python -m pip install pre-commit
- name: Test hooks
run: |
./e2e/pre-commit-hook/test.sh
4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

6 changes: 6 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- id: solhint
name: solhint
description: Lint Solidity files with Solhint
entry: solhint
types: ["solidity"]
language: node
25 changes: 21 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
## [5.0.4] - 2024-12-31
### Fixed
- `imports-order` [#595](https://github.com/protofire/solhint/pull/595) - Replaced single quotes with double quotes
- `gas-custom-errors` [#613](https://github.com/protofire/solhint/pull/613) - Allows the use of Requirement with Custom Errors
- Typos and broken links [#611](https://github.com/protofire/solhint/pull/611) - [#617](https://github.com/protofire/solhint/pull/617)
- Upgraded `solidity-parser` dependency [#612](https://github.com/protofire/solhint/pull/612)


### Added
- `.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))
- Removed `husky` since it is not needed [#612](https://github.com/protofire/solhint/pull/612)

<br><br>


## [5.0.3] - 2024-08-03
### Fixed
- New Rule: Imports order [#593](https://github.com/protofire/solhint/pull/593)
- `imports-order` [#593](https://github.com/protofire/solhint/pull/593)

<br><br>

Expand All @@ -16,10 +31,11 @@

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


<br><br>

## [5.0.0] - 2024-05-11
### BREAKING CHANGES

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

<br><br>

## [4.5.4] - 2024-04-10
### Fixed
- `gas-custom-errors` improved logic to ranged pragma versions [#573](https://github.com/protofire/solhint/pull/573)
Expand Down Expand Up @@ -68,7 +85,7 @@ Thanks to [@juanpcapurro](https://github.com/juanpcapurro) for providing the cod
- New Rule: Interface starts with `i` [#557](https://github.com/protofire/solhint/pull/557)

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

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


Expand Down
11 changes: 11 additions & 0 deletions DEV-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Setting up Git Hooks

After cloning the repository, set up the pre-commit hook by running the following commands:

`git config --unset core.hooksPath`
To reset the hooks config to git default

```sh
touch .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
echo '#!/bin/sh\nnode scripts/check-changes.js' > .git/hooks/pre-commit
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<a href="https://protofire.io/projects/solhint" target="_blank"><img src="solhint.png"></a>
<a href="https://protofire.io/solhint" target="_blank"><img src="solhint.png"></a>
</p>
<p align="center">
By <a href="https://protofire.io/" target="_blank">Protofire</a>
Expand All @@ -16,7 +16,7 @@ https://coveralls.io/github/protofire/solhint?branch=master)
This is an open source project for linting [Solidity](http://solidity.readthedocs.io/en/develop/) code. This project
provides both **Security** and **Style Guide** validations.
<br>
[VISIT OUR WEBSITE](https://protofire.io/projects/solhint)<br>
[VISIT OUR WEBSITE](https://protofire.io/solhint)<br>
[JOIN OUR DISCORD SERVER](https://discord.gg/4TYGq3zpjs)
<br>
## Installation
Expand Down Expand Up @@ -204,12 +204,24 @@ Or disable all validations for a group of lines:
### Style Guide Rules
[Full list with all supported Style Guide Rules](docs/rules.md#style-guide-rules)
### Best Practices Rules
[Full list with all supported Best Practices Rules](docs/rules.md#best-practise-rules)
[Full list with all supported Best Practices Rules](docs/rules.md#best-practices-rules)

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

## pre-commit
### Solhint can also be used as [pre-commit](https://pre-commit.com/) hook

Replace `$GIT_TAG` with real tag:

```YAML
- repo: https://github.com/protofire/solhint
rev: $GIT_TAG
hooks:
- id: solhint
```
## Documentation
Related documentation you may find [here](https://protofire.github.io/solhint/).
Expand Down Expand Up @@ -257,7 +269,7 @@ Related documentation you may find [here](https://protofire.github.io/solhint/).
The Solidity parser used is [`@solidity-parser/parser`](https://github.com/solidity-parser/parser).

## Licence
## License

MIT

Expand Down
4 changes: 2 additions & 2 deletions conf/rulesets/solhint-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ module.exports = Object.freeze({
'comprehensive-interface': 'warn',
quotes: ['error', 'double'],
'const-name-snakecase': 'warn',
'contract-name-camelcase': 'warn',
'event-name-camelcase': 'warn',
'contract-name-capwords': 'warn',
'event-name-capwords': 'warn',
'foundry-test-functions': ['warn', ['setUp']],
'func-name-mixedcase': 'warn',
'func-named-parameters': ['warn', 4],
Expand Down
4 changes: 2 additions & 2 deletions conf/rulesets/solhint-recommended.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ module.exports = Object.freeze({
'gas-custom-errors': 'warn',
quotes: ['error', 'double'],
'const-name-snakecase': 'warn',
'contract-name-camelcase': 'warn',
'event-name-camelcase': 'warn',
'contract-name-capwords': 'warn',
'event-name-capwords': 'warn',
'func-name-mixedcase': 'warn',
'immutable-vars-naming': [
'warn',
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM node:20-alpine
LABEL maintainer="diego.bale@protofire.io"
ENV VERSION=5.0.3
ENV VERSION=5.0.4

RUN npm install -g solhint@"$VERSION"
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: Solhint Configuration
date: 2017-10-23 14:16:00 +0300
author: "@drabenia"
description: Configuration of solidity security and style guide verification,
best practise validations.
best practice validations.
---

### Configuration
Expand Down
Loading

0 comments on commit 0c05a45

Please sign in to comment.