Skip to content

feat(forge): Add static analyzer - forge lint #7668

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

Closed
slvDev opened this issue Apr 15, 2024 · 1 comment
Closed

feat(forge): Add static analyzer - forge lint #7668

slvDev opened this issue Apr 15, 2024 · 1 comment
Labels
T-feature Type: feature

Comments

@slvDev
Copy link
Contributor

slvDev commented Apr 15, 2024

Component

Forge

Describe the feature you would like

Motivation

Add static analyzer in foundry to make developer's life easier and make code more clean and error-prone.

Description

A static analyzer should be a combination of known issues, common anti-patterns, informational (eg "write better code"), and gas optimization.

  • known issues
  • common anti-patterns: eg Unvalidated result of ecrecover()
  • informational: Style Guides, Complex calculation in expression, etc
  • gas optimization: eg Optimize storage/struct layout

Suggested lint options

  • --include - run only on specified files
  • --exclude - exclude specified files
  • --include-path - run linter on files matching the specified glob pattern.
  • --exclude-path - run linter on files that do not match the specified glob pattern.
  • --format: json | markdown - generate report in json or formatted markdown format
  • --only-severity: high | med | low | info | gas - use only selected severity for output (can be multiple)
  • --ignore-severity: high | med | low | info | gas - ignore selected severity (can be multiple)
  • --with-description - usually description is large, should disable it by default to avoid too long console output.
  • --show-description: detector title - show description of detector

Suggested output style

Informational: Non-specific Imports
Description(optional): This form is not recommended for use, because it unpredictably pollutes the namespace.
If you add new top-level items inside “filename”, they automatically appear in all files that import like this from “filename”.
It is better to import specific symbols explicitly.
  --> src/Counter.sol:
   |
 3 |   import "./ICounter.sol";
   |           ^^^^^^^^^^^^^^

Additional context

No response

@slvDev slvDev added the T-feature Type: feature label Apr 15, 2024
@zerosnacks
Copy link
Member

Thanks for your suggestion!

Marking as duplicate of #1970

@zerosnacks zerosnacks closed this as not planned Won't fix, can't repro, duplicate, stale Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-feature Type: feature
Projects
None yet
Development

No branches or pull requests

2 participants