ScopeLintA simple and opinionated tool designed for basic formatting/linting of Solidity and TOML code in foundry projects.
When using the ScopeLift Foundry template scopelint will automatically be ran in CI. To run locally:
cargo install scopelintOnce installed there are four commands:
scopelint fmtscopelint checkscopelint fixscopelint specFor all commands, please open issues for any bug reports, suggestions, or feature requests.
scopelint fmtThis command will format:
foundry.toml.Flags:
- --check: Show changes without modifying files (dry run mode)
scopelint checkThis command ensures that development best practices are consistently followed by validating that:
^test(Fork)?(Fuzz)?(_Revert(If|When|On))?_(\w+)*$. (To see a list of example valid test names, see here).ALL_CAPS.run method per script.Path configuration: scopelint check (and scopelint spec) use your existing Foundry paths so they work with non-default layouts (e.g. contracts/ instead of src/). Paths are read from foundry.toml in the same way as Forge:
[profile.default] (or root-level) src, test, and script are used.[check] section:```toml [profile.default] src = "contracts" test = "test" script = "script"
# Optional: scopelint-specific path overrides (defaults to profile.default if omitted) [check] src_path = "./contracts" script_path = "./script" test_path = "./test" ```
If [check] is omitted, Foundry’s paths are used as-is, so no re-definition is required.
More checks are planned for the future.
Scopelint is opinionated in that it does not let you disable rules globally. However, you can ignore specific rules for specific files using:
Inline comments in your Solidity files:
solidity
// scopelint: ignore-src-file // Ignore 'src' rule for entire file
// scopelint: ignore-error-next-line // Ignore 'error' rule for next line
.scopelint config file in your project root:
```toml
# Ignore entire files
[ignore]
files = [
"src/legacy/old.sol",
"test/integration/*.sol"
]
# Ignore specific rules for specific files [ignore.overrides] "src/BaseBridgeReceiver.sol" = ["src"] # Only ignore 'src' rule "src/legacy/*/.sol" = ["src", "error"] # Ignore multiple rules ```
Supported rules: error, import, variable, constant, test, script, src, eip712
scopelint fixApplies safe, automatic fixes and then runs scopelint check. Currently supports:
import { A, B } from "...") and removes entire aliased import lines (import "..." as Alias) when the alias is unused.Only findings that are not ignored (via inline comments or .scopelint) are fixed. After fixing, any remaining convention or formatting issues are reported as with scopelint check.
scopelint specMost developers don't have formal specifications they are building towards, and instead only have a general idea of what they want their contracts to do. As a result, documentation and tests are the closest things many protocols have to a specification (unless they go through the formal verification process). And because documentation is often not written until the end of the development process, it is often incomplete or inaccurate, and therefore tests are typically the closest thing to a specification.
scopelint spec embraces this philosophy of "your tests are your spec" to help developers come up with a spec with minimal effort—structure your tests contracts and test names and described in the Best Practices guide, and scopelint spec will generate a specification for you!
This specification can be shared with other stakeholders to make sure everyone is on the same page about what the contract should do.
Below is a simple example for an ERC-20 token, the full example repo can be found here.

Flags:
- --show-internal: Include internal and private functions in the specification (by default, only public and external functions are shown)
Currently this feature is in beta, and we are looking for feedback on how to improve it. Right now it's focused on specifications for unit tests, which are very useful for developers but less useful for higher-level stakeholders. As a result, it does not yet include information about protocol invariants or integration test / user-story types of specifications. If you have any thoughts or ideas, please open an issue here.
For developers interested in contributing to scopelint, please see our Development Guide for detailed information about:
$ claude mcp add scopelint \
-- python -m otcore.mcp_server <graph>