Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
#!/bin/sh
set -e pipefail
set -e

# Dependency sorting
if ! cargo sort --workspace --check; then
echo "❌ Dependencies should be sorted (run 'cargo sort --workspace')"
exit 1
fi

# Dependency audit
cargo deny check || {
if ! cargo deny check; then
echo "❌ Critical: Vulnerable dependencies detected (run 'cargo deny check')"
exit 1
}
exit 2
fi

# Formatting check
cargo fmt --all -- --check || {
if ! cargo fmt --all -- --check; then
echo "❌ Formatting issues (run 'cargo fmt --all')"
exit 2
}
exit 3
fi

# Typo check
typos || {
if ! typos; then
echo "❌ Spelling mistakes found (run 'typos --write-changes')"
exit 3
}
exit 4
fi

# Linting
cargo clippy --all-targets --all-features -- -D warnings || {
if ! cargo clippy --all-targets --all-features -- -D warnings; then
echo "❌ Clippy violations (check warnings above)"
exit 4
}
exit 5
fi

# Tests
cargo test --workspace --verbose || {
if ! cargo test --workspace --verbose; then
echo "❌ Test failures detected"
exit 5
}
exit 6
fi

echo "✅ All checks passed!"
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ git config commit.gpgsign true
* [Rust](https://www.rust-lang.org/tools/install)
* [cargo deny](https://github.com/EmbarkStudios/cargo-deny)
* [typos](https://github.com/crate-ci/typos?tab=readme-ov-file#install)
* [cargo sort](https://github.com/DevinR528/cargo-sort)

## Code quality assurance

Expand Down
17 changes: 7 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@

# TODO(template) update for the crate name
[workspace]
members = ["examples", "mycrate"]
resolver = "2"
default-members = ["mycrate"]
[workspace.package]
version = "0.1.0"
edition = "2021"
# TODO(template) update for your repository
repository = "https://github.com/NethermindEth/rust-template"
license = "Apache-2.0" # TODO(template) update license if needed

# TODO(template) update for the crate name
[workspace]
members = [
"examples",
"mycrate",
]
resolver = "2"
default-members = ["mycrate"]

[workspace.dependencies]

[workspace.lints.rust]
Expand All @@ -33,4 +30,4 @@ cast_precision_loss = "deny"
cast_sign_loss = "deny"
needless_return = "deny"
panicking_overflow_checks = "deny"
unwrap_used = "deny"
unwrap_used = "deny"
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@ TODO(template) describe the project
## TODO(template) - rust template usage (remove this section after setup)

This is a rust template from ZKE team :rocket: (a focus on cryptographic libs in sync Rust).
To use it - find `TODO(template)` over the repository and set appropriate values.

:bike: To use it - find `TODO(template)` over the repository and set appropriate values.

- [ ] Settings -> Collaborators and teams - add your team group as admins for the repo (e.g. [zk-engineering](https://github.com/orgs/NethermindEth/teams/zk-engineering))
- [ ] Settings -> General -> Pull Requests - allow only `Allow squash merging`, also tick `Automatically delete head branches`
- [ ] Settings -> Pages -> Build and deployment -> Source Github Actions
- [ ] Update the description of the repo at the repo's page, add tag topics
- [ ] Introduce necessary sections at the repo's page (releases, deployments etc)
- [ ] Add a website url (if applicable) or a docs page (see [docs](./.github/workflows/docs.yml) flow for public repos)
- [ ] add [all contributors](https://allcontributors.org/docs/en/cli/installation)
- [ ] import protection rulesets (see below) in the repo settings (Settings -> Rules -> Rulesets -> Import a ruleset)
- [ ] Add [all contributors](https://allcontributors.org/docs/en/cli/installation)
- [ ] Import protection rulesets (see below) in the repo settings (Settings -> Rules -> Rulesets -> Import a ruleset)
- [ ] For binary crates with specific requirements to Rust features consider also [pinning](https://rust-lang.github.io/rustup/overrides.html#the-toolchain-file) the rust toolchain version

Main branch protection

Expand Down Expand Up @@ -104,7 +106,8 @@ See [examples](./examples/).

## License

TODO(template) - update [license](https://www.notion.so/nethermind/Open-Source-Software-Usage-and-Licensing-Policy-1c3360fc38d080fd9e61c29b35d1d5af) if needed
TODO(template) - update [license](https://www.notion.so/nethermind/Open-Source-Software-Usage-and-Licensing-Policy-1c3360fc38d080fd9e61c29b35d1d5af) if needed.
For commercial licenses it is required to get an approve from Legal.

Apache 2.0

Expand Down
4 changes: 2 additions & 2 deletions mycrate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ license.workspace = true
# Use `default-features = false`
# and explicitly list features to prevent code bloat and
# code break after upgrades
thiserror = {version = "1.0", default-features = false }
thiserror = { version = "1.0", default-features = false }

# TODO(template)
# don't forget to put this at every crate
# to inherit workspace's lints
[lints]
workspace = true
workspace = true