Skip to content

Conversation

@clement-ux
Copy link
Contributor

@clement-ux clement-ux commented Nov 25, 2025

Description

Forge provides a new linter based on Solar, a Rust based solidity compiler.
This PR aims to discuss about should we use it or not?
Note: we can choose to only run it on contracts, not on script or test.

Pros

  • We could have a standardized approach for variable naming (this is the biggest point).
  • We could enforce it when creating a PR, to ensure code is standardized.
  • It could help us to fix issue before they appear: like unsafe-typecast (this is the only case I encountered):
warning[unsafe-typecast]: typecasts that can truncate values should be checked
   --> src/contracts/AbstractARM.sol:594:33
    |
594 |         uint40 claimTimestamp = uint40(block.timestamp + claimDelay);
    |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |

Cons

  • Less flexibility on the naming (but this help to standardize the code).
  • A lot of false alarm like this one, but we can easily remove it with inline comment though.
warning[erc20-unchecked-transfer]: ERC20 'transfer' and 'transferFrom' calls should check the return value
   --> src/contracts/AbstractARM.sol:651:9
    |
651 |         IERC20(liquidityAsset).transfer(msg.sender, assets);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |

How to try

Ensure you use last Foundry version + build

foundryup
forge b

Try linter

forge l

Docs

@clement-ux clement-ux changed the title improve lint Improve Linter Nov 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants