Skip to content

chore: Justfile#14

Open
igorroncevic wants to merge 4 commits intomainfrom
pr-05-justfile-coverage
Open

chore: Justfile#14
igorroncevic wants to merge 4 commits intomainfrom
pr-05-justfile-coverage

Conversation

@igorroncevic
Copy link
Copy Markdown
Contributor

@igorroncevic igorroncevic commented May 6, 2026

Description

Add just commands for build, format, lint, Slither, tests, coverage, snapshots, and all checks.

Context

This PR depends on the previous PRs. It is only fully testable after the Foundry config, local dependencies, Solhint, and Slither PRs are merged.

Out of Scope

This PR does not add CI or git hooks.

Testing Instructions

@igorroncevic igorroncevic marked this pull request as ready for review May 6, 2026 15:27
@igorroncevic igorroncevic requested a review from a team as a code owner May 6, 2026 15:27
Comment thread Justfile
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know that in the previous iteration of this PR you were suggested to use a Justfile, but since we have package.json already in use and most of these commands are one-liners, we can use package.json scripts instead, right?

If a command is longer than one line or would be better on multiple lines, a script can be added like in a scripts/ directory and called by pnpm.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point, but in case of some longer commands (like snapshots, Solhint etc) it's easier to just write just <target> instead of remembering the full command.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit annoying to use NPM scripts here because package.json is in dev and so it would be something like npm run --prefix dev whatever.

The Just file looks more easy to work with than NPM scripts so I'm weakly in favor of keeping the new tool. But I'm also fine with dropping it for simplicity if we decide that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool that it even works my <tab> autocomplete too

Image

Comment thread Justfile Outdated
Comment thread Justfile Outdated
Comment thread Justfile Outdated

# Print coverage summary (excludes `test`/`script` files)
coverage-summary:
forge coverage --no-match-coverage "(test|script)" --report summary
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mention here, the regex matches too much, we should match based on the start of the path.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by adding "^" at the start to only filter the start of the path.

Copy link
Copy Markdown
Contributor

@fedgiac fedgiac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Just small comments.

Comment on lines +1 to +3
{
"increment - success": "43476"
} No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How was this file generated? I removed it and tried to recreate it with any commands from just and it didn't work.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I've removed a vm.snapshotGasLastCall from a test file by mistake. If you run just snapshot now, it will be present.

Comment thread Justfile
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit annoying to use NPM scripts here because package.json is in dev and so it would be something like npm run --prefix dev whatever.

The Just file looks more easy to work with than NPM scripts so I'm weakly in favor of keeping the new tool. But I'm also fine with dropping it for simplicity if we decide that.

Comment thread Justfile Outdated

# Run tests with `forge test`
test:
forge test --force --isolate -vvv --show-progress --gas-snapshot-check true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments from here and here still apply. Notably I'd drop --force from everywhere but build-all.
Also applies to snapshot.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really think keeping --force flag in these commands is helpful to avoid caching issues, but I'm fine with removing it and simply running build-all if they happen.

Comment thread Justfile Outdated
Comment thread README.md Outdated
Copy link
Copy Markdown
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only minor comments

Comment thread Justfile Outdated
Comment thread Justfile Outdated
forge snapshot --force --isolate --desc --show-progress

# Run build, lint, slither, test, coverage-check, snapshot
all:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not using Just dependencies instesad of imperative form?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, didn't use Justfile much before and was used to Makefile syntax

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.

4 participants