Comments (4)
Foundry considers only public or external functions tests, so I agree about the public qualifier.
I agree that the best way to add support for this rule would be to be able to nested Solhint configurations in folders, but I would smile upon having one of the interim solutions you mentioned (e.g. .solhint.test.json
).
from solhint.
@PaulRBerg you mean a rule to do what ?
check that the prefix of any function is with one of those for testing ?
from solhint.
check that the prefix of any function is with one of those for testing ?
Yes. A rule that would activate the regex above.
from solhint.
Some thoughts on this.
First, I guess the behavior of the new rule should be: "If a (public?) function starts with test
, then check that it follows the naming convention". Not sure about the public part, but I guess it makes sense.
Second, having some way to only apply the rule for files in a given directory makes a lot of sense, but I'm not sure what's the best way to accomplish it. Possible solutions:
- The best way IMO would be to have a separate
.solhint.json
file inside thetest
directory, that extends the config file in the parent directory. This is a useful pattern, and the way this is done in eslint-land. But I'm pretty sure that solhint doesn't support this (it should). - Alternatively, the rule could have a
testDirectory
option, or something like that. Since I think the previous alternative is way better (and useful in other contexts), I believe adding this option would eventually become dead weight. But it's certainly the easiest way to accomplish this. Idk.
A middle ground would be this: have two solhint files .solhint.json
and .solhint-tests.json
, and make the second one extend the first (this is also not supported, but it's easier to do). Then have two npm scripts: lint
and lint-tests
(or whatever) and make the second one explicitly use the second config file and the tests directory.
from solhint.
Related Issues (20)
- Update dependencies HOT 3
- test the different formatters HOT 1
- Add `explicit-types` rule HOT 4
- Support for named parameters in mappings (Solidity v0.8.18) HOT 7
- `assembly ("memory-safe")` not supported HOT 2
- `initializer` modifier should be treated as constructor within `ordering` rule HOT 1
- Error when running with --max-warnings and wrong file pattern that matches zero files HOT 2
- "named-parameters-mapping" should not apply to nested mappings HOT 11
- Remove Travis and add a GH workflow file to run the lint and test scripts HOT 1
- Unicode literals implicitly converting to fixed size byte arrays cause incorrect error HOT 4
- Remove or fix broken badges from README HOT 2
- "no-global-import" should not apply to named global imports HOT 2
- Stop publishing the test directory HOT 3
- Does not work with UDVT operators (Solidity 0.8.19) HOT 1
- make static binary or appimage, like solc HOT 2
- Add easily accessible list of depreciated rules HOT 2
- create enable-all extention HOT 1
- What rules are in `solhint:default`? HOT 2
- Solhint did nothing HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from solhint.