ratatui/CONTRIBUTING.md
SLASHLogin 669a4d5652
build: add git pre-push hooks using cargo-husky (#274)
Fixes https://github.com/tui-rs-revival/ratatui/issues/214
- add cargo-husky to dev-deps
- create hook
- update `CONTRIBUTING.md`
- ensure that the hook is not installed in CI
2023-06-24 06:03:31 +00:00

3.9 KiB

Fork Status

Pull Requests

All pull requests opened on the original repository have been imported. We'll be going through any open PRs in a timely manner, starting with the smallest bug fixes and README updates. If you have an open PR make sure to let us know about it on our discord as it helps to know you are still active.

Issues

We have been unsuccessful in importing all issues opened on the previous repository. For that reason, anyone wanting to work on or discuss an issue will have to follow the following workflow :

  • Recreate the issue
  • Start by referencing the original issue: Referencing issue #[<issue number>](<original issue link>)
  • Then, paste the original issues opening text

You can then resume the conversation by replying to this new issue you have created.

Closing Issues

If you close an issue that you have "imported" to this fork, please make sure that you add the issue to the CLOSED_ISSUES.md. This will enable us to keep track of which issues have been closed from the original repo, in case we are able to have the original repository transferred.

Contributing

Implementation Guidelines

Use of unsafe for optimization purposes

Do not use unsafe to achieve better performances. This is subject to change, see. The only exception to this rule is if it's to fix reproducible slowness.

Building

ratatui is an ordinary Rust project where common tasks are managed with cargo-make. It wraps common cargo commands with sane defaults depending on your platform of choice. Building the project should be as easy as running cargo make build.

🛠️ Pull requests

All contributions are obviously welcome. Please include as many details as possible in your PR description to help the reviewer (follow the provided template). Make sure to highlight changes which may need additional attention or you are uncertain about. Any idea with a large scale impact on the crate or its users should ideally be discussed in a "Feature Request" issue beforehand.

Committing

To avoid any issues that may arrise with the CI/CD by not following the conventional commit syntax, we recommend to install Commitizen.
By using this tool you automatically follow the configuration defined in .cz.toml.

Additionally, we're using cargo-husky to automatically load pre-push hook, which will run cargo make ci before each push. It will load the hook automatically when you run cargo test. If cargo-make is not installed, it will install it for you.
This will ensure that your code is formatted, compiles and passes all tests before you push. If you want to skip this check, you can use git push --no-verify.

Continuous Integration

We use Github Actions for the CI where we perform the following checks:

  • The code should compile on stable and the Minimum Supported Rust Version (MSRV).
  • The tests (docs, lib, tests and examples) should pass.
  • The code should conform to the default format enforced by rustfmt.
  • The code should not contain common style issues clippy.

You can also check most of those things yourself locally using cargo make ci which will offer you a shorter feedback loop.

Tests

The test coverage of the crate is far from being ideal but we already have a fair amount of tests in place. Beside the usual doc and unit tests, one of the most valuable test you can write for ratatui is a test against the TestBackend. It allows you to assert the content of the output buffer that would have been flushed to the terminal after a given draw call. See widgets_block_renders in tests/widgets_block.rs for an example.