Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gitignore syntax not fully supported #346

Open
ddnexus opened this issue Jun 11, 2022 · 4 comments
Open

Gitignore syntax not fully supported #346

ddnexus opened this issue Jun 11, 2022 · 4 comments

Comments

@ddnexus
Copy link

ddnexus commented Jun 11, 2022

To ignore files that do not require validation you can use a .solhintignore file. It supports rules in the .gitignore format.

The pattern to ignore a dir excluding specific files in .gitignore does not seem to work:

*
!not-this-file.sol
@dbale-altoros
Copy link
Collaborator

@ddnexus
Solhint works like this.
Given this file structure:
(Brackets name represent folders just for better understanding)

[contracts]
contracts\ONE.sol
contracts\TWO.sol
[contracts\adapters]
contracts\adapters\THREE.sol
contracts\adapters\FOUR.sol
[contracts\adapters\uniswap]
contracts\adapters\uniswap\UNI.sol

If you want to run solhint on all files:
solhint contracts/*.* contracts/**/*.* contracts/**/**/*.*

If you want to run solhint on adapters folders and all of subfolders
solhint contracts/**/*.* contracts/**/**/*.*

If you want to exclude FOUR.sol and run in all other files:
Fill .solhintignore with this line
contracts/adapters/FOUR.sol
Then run
solhint contracts/*.* contracts/**/*.* contracts/**/**/*.*
FOUR.sol will be excluded

From your post I think you want to put a folder in the .solhintignore and with that notation you want to ignore the whole folder but not the file with the exclamation point, meaning:
If I put in .solhintignore this:
contracts/adapters/
!contracts/adapters/FOUR.sol

You want solhint to process only FOUR.sol from adapters folder...
Is that correct ?

@dbale-altoros dbale-altoros added the awaiting user feedback awaiting user feedback label Jul 10, 2023
@ddnexus
Copy link
Author

ddnexus commented Jul 11, 2023

Yes, that's how gitignore works!

Without it you would have to check the structure of contracts/adapters/ and update the many solhint arguments every time it changes.

@dbale-altoros dbale-altoros added config addition and removed awaiting user feedback awaiting user feedback labels Jul 11, 2023
@dbale-altoros
Copy link
Collaborator

thanks for the clarification
it is a good addition
we'll try to add that

@ddnexus
Copy link
Author

ddnexus commented Jul 11, 2023

BTW, the "file" could also be a pattern itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants