-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(forge): Forge Lint #9590
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
feat(forge): Forge Lint #9590
Conversation
feat(forge): Forge Lint
Fantastic. Really excited for this. Anything we can learn from slither here as well? |
Hello just bumping this, let me know if you would like me to continue with this direction or if you would rather iterate on the current approach before moving forward with this feature. |
I would rather have each lint emit the diagnostic as soon as the conditions are met. The approach should be the same as in clippy since the diagnostic APIs are identical. See also https://rustc-dev-guide.rust-lang.org/diagnostics.html Here's the rustc implementation https://github.com/rust-lang/rust/blob/2620eb42d72d24baa1ca1056a769862b92c85f7f/compiler/rustc_lint/src/early.rs#L29 |
Sounds good, thanks for the clarity, Ill update the PR accordingly. |
hey @0xKitsune ! Will you be able to push this PR over the finish based on the feedback provided? alternatively, please flag and we can take it over if you cannot invest any more time |
Hey @jenpaff, thanks for bumping this and sorry for the long delay. This got buried with other priorities on my side, but I can update the PR this week. I can certainly help push Ill get this PR updated this week! |
awesome, feel free to flag if you need any support from us. |
Hey @DaniPopes, I have a few quick questions for clarification. This one is a bit outside my usual wheelhouse and I want to make sure I understand the recommended approach before updating the PR.
IIUC clippy lints generally adhere to the following implementation details (using PubUse as an example):
I am under the impression that we can not use
Let me know if this is in the right direction or feel free to clarify anything that I may be misunderstanding/overlooking. |
Hey @jenpaff @DaniPopes just bumping this. Let me know if you have any thoughts on the approach above. Happy to get this PR over the line, just would like clarity on the approach. If you'd prefer to take it in a different direction or have someone else with more bandwidth handle it, no worries just let me know! |
Sorry I missed this, yes the approach looks right! |
sg ! We can add this to the next release, let us know if you need anymore support |
Hey @0xKitsune, @0xrusowsky will be taking over in #10405 on top of this PR, thanks for your work! |
ref #1970
This PR introduces
forge lint
, which implements a static analyzer built on top ofsolar
and is capable of detecting known issues, vulnerabilities, informational warnings and gas optimizations. This is a first pass atforge lint
and I am opening this draft in order to receive early feedback on the design and general direction.The core component of this design centers around the
declare_lints!
macro which allows you to specify the pattern along with the severity, name and description.Once the pattern is defined, you can implement the
Visit
trait to match on any instances of the pattern.There is still quite a bit of work to do but if this direction makes sense, I am happy to continue adding the rest of the features as well as additional patterns. I can also port over any of the patterns from solstat, sstan or start working on patterns in other static analysis tools like
slither
as well.