Skip to content

Commit f45b7c2

Browse files
authored
chore: clean up Makefile and update contribution guide (#10602)
* update makefile and instructions * clean up
1 parent b811823 commit f45b7c2

File tree

2 files changed

+48
-36
lines changed

2 files changed

+48
-36
lines changed

CONTRIBUTING.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ elsewhere.
4040

4141
If you have reviewed existing documentation and still have questions, or you are having problems, you can get help in the following ways:
4242

43-
- **Asking in the support Telegram:** The [Foundry Support Telegram][support-tg] is a fast and easy way to ask questions.
44-
- **Opening a discussion:** This repository comes with a discussions board where you can also ask for help. Click the "Discussions" tab at the top.
43+
- **Asking in the support Telegram:** The [Foundry Support Telegram][support-tg] is a fast and easy way to ask questions.
44+
- **Opening a discussion:** This repository comes with a discussions board where you can also ask for help. Click the "Discussions" tab at the top.
4545

4646
As Foundry is still in heavy development, the documentation can be a bit scattered.
4747
The [Foundry Book][foundry-book] is our current best-effort attempt at keeping up-to-date information.
@@ -54,10 +54,10 @@ If you believe that you have uncovered a bug, please fill out the form to the be
5454

5555
The most important pieces of information we need in a bug report are:
5656

57-
- The Foundry version you are on (and that it is up to date)
58-
- The platform you are on (Windows, macOS, an M1 Mac or Linux)
59-
- Code snippets if this is happening in relation to testing or building code
60-
- Concrete steps to reproduce the bug
57+
- The Foundry version you are on (and that it is up to date)
58+
- The platform you are on (Windows, macOS or Linux)
59+
- Code snippets if this is happening in relation to testing or building code
60+
- Concrete steps to reproduce the bug
6161

6262
In order to rule out the possibility of the bug being in your project, the code snippets should be as minimal
6363
as possible. It is better if you can reproduce the bug with a small snippet as opposed to an entire project!
@@ -86,7 +86,14 @@ Please also make sure that the following commands pass if you have changed the c
8686
cargo check --all
8787
cargo test --all --all-features
8888
cargo +nightly fmt -- --check
89-
cargo +nightly clippy --all --all-targets --all-features -- -D warnings
89+
cargo +nightly clippy --all --all-targets --all-features -- -D warning
90+
```
91+
92+
or alternatively:
93+
94+
```sh
95+
make build
96+
make pr
9097
```
9198

9299
If you are working in VSCode, we recommend you install the [rust-analyzer](https://rust-analyzer.github.io/) extension, and use the following VSCode user settings:
@@ -103,7 +110,7 @@ If you are working on a larger feature, we encourage you to open up a draft pull
103110

104111
If you would like to test the binaries built from your change, see [foundryup](https://github.com/foundry-rs/foundry/tree/master/foundryup).
105112

106-
If you would like to use a debugger with breakpoints to debug a patch you might be working on, keep in mind we currently strip debug info for faster builds, which is *not* the default. Therefore, to use a debugger, you need to enable it on the workspace [`Cargo.toml`'s `dev` profile](https://github.com/foundry-rs/foundry/tree/master/Cargo.toml#L15-L18).
113+
If you would like to use a debugger with breakpoints to debug a patch you might be working on, keep in mind we currently strip debug info for faster builds, which is _not_ the default. Therefore, to use a debugger, you need to enable it on the workspace [`Cargo.toml`'s `dev` profile](https://github.com/foundry-rs/foundry/tree/master/Cargo.toml#L15-L18).
107114

108115
#### Adding tests
109116

@@ -113,9 +120,9 @@ in the future.
113120

114121
Types of tests include:
115122

116-
- **Unit tests**: Functions which have very specific tasks should be unit tested.
117-
- **Integration tests**: For general purpose, far reaching functionality, integration tests should be added.
118-
The best way to add a new integration test is to look at existing ones and follow the style.
123+
- **Unit tests**: Functions which have very specific tasks should be unit tested.
124+
- **Integration tests**: For general purpose, far reaching functionality, integration tests should be added.
125+
The best way to add a new integration test is to look at existing ones and follow the style.
119126

120127
Tests that use forking must contain "fork" in their name.
121128

Makefile

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -73,46 +73,51 @@ docker-build-prepare: ## Prepare the Docker build environment.
7373
docker buildx use cross-builder; \
7474
fi
7575

76-
##@ Other
76+
##@ Test
7777

78-
.PHONY: clean
79-
clean: ## Clean the project.
80-
cargo clean
78+
.PHONY: test-unit
79+
test-unit: ## Run unit tests.
80+
cargo nextest run -E 'kind(test) & !test(/\b(issue|ext_integration)/)'
81+
82+
.PHONY: test-doc
83+
test-doc: ## Run doc tests.
84+
cargo test --doc --workspace
85+
86+
.PHONY: test
87+
test: ## Run all tests.
88+
make test-unit && \
89+
make test-doc
8190

82-
## Linting
91+
##@ Linting
8392

8493
fmt: ## Run all formatters.
8594
cargo +nightly fmt
8695
./.github/scripts/format.sh --check
8796

88-
lint-foundry:
89-
RUSTFLAGS="-Dwarnings" cargo +nightly clippy --workspace --all-targets --all-features
90-
91-
lint-codespell: ensure-codespell
92-
codespell --skip "*.json"
97+
lint-clippy: ## Run clippy on the codebase.
98+
cargo +nightly clippy \
99+
--workspace \
100+
--all-targets \
101+
--all-features \
102+
-- -D warnings
93103

94-
ensure-codespell:
95-
@if ! command -v codespell &> /dev/null; then \
96-
echo "codespell not found. Please install it by running the command `pip install codespell` or refer to the following link for more information: https://github.com/codespell-project/codespell" \
104+
lint-codespell: ## Run codespell on the codebase.
105+
@command -v codespell >/dev/null || { \
106+
echo "codespell not found. Please install it by running the command `pipx install codespell` or refer to the following link for more information: https://github.com/codespell-project/codespell" \
97107
exit 1; \
98-
fi
108+
}
109+
codespell --skip "*.json"
99110

100111
lint: ## Run all linters.
101112
make fmt && \
102-
make lint-foundry && \
113+
make lint-clippy && \
103114
make lint-codespell
104115

105-
## Testing
106-
107-
test-foundry:
108-
cargo nextest run -E 'kind(test) & !test(/\b(issue|ext_integration)/)'
109-
110-
test-doc:
111-
cargo test --doc --workspace
116+
##@ Other
112117

113-
test: ## Run all tests.
114-
make test-foundry && \
115-
make test-doc
118+
.PHONY: clean
119+
clean: ## Clean the project.
120+
cargo clean
116121

117122
pr: ## Run all tests and linters in preparation for a PR.
118123
make lint && \

0 commit comments

Comments
 (0)