ScopeLift / scopelint

An opinionated formatting and linting tool for foundry projects
79 stars 5 forks source link

Expand the scope of the naming convention regex #32

Closed PaulRBerg closed 1 year ago

PaulRBerg commented 1 year ago

I'm not sure if this is the best place to post this feature request, but based on a recent discussion in Sablier V2 Core (ref https://github.com/sablier-labs/v2-core/discussions/647), we decided to start using the following test function name:

test_RevertGiven_Something

So I would like the naming convention regex to be expanded to allow for both RevertGiven and RevertWhen. WDYT? I think that the regex is already flexible insofar as it supports RevertIf.

The goal is to mirror the Given keyword in Solidity (we started using Given in the branching trees).

mds1 commented 1 year ago

I'm open to this and it's an easy change, but I first want to better understand when you'd use this naming convention with the BTT approach? I'd love to see an example of a sample tree and resulting test name (for both the given and when cases) to help get on the same page

PaulRBerg commented 1 year ago

Thanks! and sure.

There are many examples in V2 Core that intersperse given with where, here's one

https://github.com/sablier-labs/v2-core/blob/925630dd28f4a47ff2883b281af812f9958b957e/test/integration/concrete/lockup/burn/burn.tree

And then see the test_RevertGiven functions here:

https://github.com/sablier-labs/v2-core/blob/925630dd28f4a47ff2883b281af812f9958b957e/test/integration/concrete/lockup/burn/burn.t.sol

mds1 commented 1 year ago

Just noting that v0.0.19 has been released with this feature!