Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define a basic toolset for this repository #1

Closed
cedoor opened this issue Jun 28, 2024 · 5 comments · Fixed by #2
Closed

Define a basic toolset for this repository #1

cedoor opened this issue Jun 28, 2024 · 5 comments · Fixed by #2
Assignees
Labels
devops 🔧 Operations management and dev tools question ❔ Further information is requested

Comments

@cedoor
Copy link
Member

cedoor commented Jun 28, 2024

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

@cedoor cedoor added question ❔ Further information is requested devops 🔧 Operations management and dev tools labels Jun 28, 2024
@cedoor cedoor assigned cedoor and sripwoud and unassigned cedoor and sripwoud Jun 28, 2024
@cedoor cedoor added this to ZK-Kit Jun 28, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in ZK-Kit Jun 28, 2024
@cedoor cedoor moved this from 📋 Backlog to 🗒 Tasks in ZK-Kit Jun 28, 2024
@cedoor cedoor moved this from 🗒 Tasks to 🏗 In Progress in ZK-Kit Jun 28, 2024
@curryrasul
Copy link
Member

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?

  • Use https://github.com/Swatinem/rust-cache in CI to make it faster.
  • Also would recommend reading these blog posts on testing: first and second
  • Might also consider adding Architecture.md or some helper file that'll have explanation on how repo is designed, so that new contributors can find a place they need to change faster

@cedoor

@0xjei
Copy link
Member

0xjei commented Jun 28, 2024

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

@sripwoud
Copy link
Member

sripwoud commented Jun 28, 2024

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:

  • As test runner I'd suggest nextest which is faster and has a nicer printer than cargo test.
  • to cover formatting of all files (md, rs, yml...) with a single command, I'd suggest dprint
  • to glue everything together and nicer dx, we'll need a task runner, could be a make file or for something more modern that exists as cargo crate, I like just
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
Copy link
Member

It looks great! I'm excited about it.

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

@cedoor cedoor moved this from 🏗 In Progress to 👀 In Review in ZK-Kit Jul 2, 2024
@cedoor
Copy link
Member Author

cedoor commented Jul 2, 2024

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

I think @sripwoud's table is great.

PR: #2. Let's continue this discussion there.

@github-project-automation github-project-automation bot moved this from 👀 In Review to ✔️ Done in ZK-Kit Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devops 🔧 Operations management and dev tools question ❔ Further information is requested
Projects
Status: ✔️ Done
Development

Successfully merging a pull request may close this issue.

5 participants