#linting #formatting #foundry

bin+lib scopelint

An opinionated formatting and linting tool for foundry projects

11 releases

Uses new Rust 2021

0.0.11 Nov 7, 2022
0.0.10 Nov 2, 2022
0.0.6 Oct 17, 2022

#900 in Development tools

Download history 107/week @ 2022-10-04 45/week @ 2022-10-11 20/week @ 2022-10-18 35/week @ 2022-10-25 115/week @ 2022-11-01 23/week @ 2022-11-08

204 downloads per month

MIT license

8MB
342 lines

ScopeLint

A simple and opinionated tool designed to for basic formatting/linting of Solidity and TOML code in foundry projects.

Overview

Solidity formatting uses the configuration in foundry.toml, and TOML formatting has a hardcoded configuration.

Formatting and checking does the following:

  • Runs forge fmt to format Solidity.
  • Uses the taplo crate to format TOML.
  • Validates test names follow a convention of test(Fork)?(Fuzz)?_(Revert(If_|When_){1})?\w{1,}.
  • Validates constants and immutables are in ALL_CAPS.
  • Validates function names and visibility in forge scripts to 1 public run method per script.
  • Validates internal functions in src/ start with a leading underscore.

Usage

  • Install with cargo install scopelint.
  • Format code with scopelint fmt.
  • Validate formatting with scopelint check.
  • Print the version with scopelint --version.
  • Use the ScopeLift foundry template to automatically run scopelint and slither in CI.

Limitations

  1. This tool is currently opinionated and does not let you configure it's behavior.
  2. It's regex-based, so it may not be perfect—for example, it doesn't care that code is commented out.

Dependencies

~11MB
~274K SLoC