privacy-scaling-explorations / zk-kit.rust

A monorepo of reusable crates for zero-knowledge technologies.
MIT License
0 stars 0 forks source link

Define a basic toolset for this repository #1

Open cedoor opened 1 week ago

cedoor commented 1 week ago

The repository has been initialized with a minimal structure:

The current tools used to test, format, and analyze code statically are Rust's default ones:

It's important to keep it minimal, but there should be some requirements we're trying to meet in all zk-kit repos:

  1. Adhere to the Github community standards.
  2. Clearly define responsibilities on the code (i.e. code owners).
  3. Always build and test all code whenever a PR is created or the main branch is updated (CI workflow).
  4. Always check if the code is well formatted and has no syntactic errors whenever a PR is created or the main branch is updated (CI workflow).
  5. Monitor and keep test coverage high (ideally 100%).
  6. Provide an interactive git commit command to assist developers in adhering to the conventional commits guidelines.
  7. Always add clear documentation to the code and generate a static documentation website automatically from the code/comments.
  8. Audit code at regular frequency.

In this issue, the goal is to determine the best tools to use for items 3, 4, 5, 6, and 7.

Q1: Are rustfmt and Clippy good enough? Q2: Does Rust provide commands to generate a test coverage report? Q3: Do you know any tool similar to https://cz-git.qbb.sh? (maybe Cocogitto ?) Q4: Is there any tool to generate static documentation websites from the code? Q5: Is there any other cool tool we should use? Q6: Any other suggestions?

@sripwoud @curryrasul @0xjei @vplasencia

curryrasul commented 1 week ago

Are rustfmt and Clippy good enough?

Sure, these are tools that are in official rust-toolchain, they "define" a standard for formatting & linting

Does Rust provide commands to generate a test coverage report?

Rust itself no, but there's a separate binary crate called cargo-tarpaulin. I used it. It outputs test coverage + compatible with other tools (such as codecov)

Is there any tool to generate static documentation websites from the code?

Built-in cargo doc. Or you can also use good static generators such as mdbook, etc.

Is there any other cool tool we should use?

Maybe cargo-deny - it analyzes if there're same dependencies used many times between crates. Also cargo audit - it checks if there're vulnerable dependencies in the project

Any other suggestions?

@cedoor

0xjei commented 1 week ago

@curryrasul answer to each question is pretty solid - nothing to add here, the suggested readings for testing are lit.

sripwoud commented 1 week ago

I agree with previous answers. I think cargo built in features got us covered for most of our needs: rustfmt clippy cargo doc... For conventional commits, I don't know it but we can give https://docs.cocogitto.io/ a try. I don't see it having a feature to interactively create conventional commits though. We can also stick to cz (assuming devs will have it installed globally)

Additionally:

need tool
formatting rustfmt (with dprint exec plugin)
linting cargo clippy
docs cargo doc
tests runner cargo nestest
ci github action
tasks runner just/ make?
vplasencia commented 5 days ago

It looks great! I'm excited about it.

This may be helpful: https://blessed.rs/crates

cedoor commented 5 days ago

Thank you all @sripwoud @0xjei @curryrasul @vplasencia!

I think @sripwoud's table is great.

PR: https://github.com/privacy-scaling-explorations/zk-kit.rust/pull/2. Let's continue this discussion there.