2019-07-03 21:22:36 -04:00
# Contributing to `typos`
2019-01-22 17:01:33 -05:00
Thanks for wanting to contribute! There are many ways to contribute and we
appreciate any level you're willing to do.
## Feature Requests
Need some new functionality to help? You can let us know by opening an
[issue][new issue]. It's helpful to look through [all issues][all issues] in
2024-06-02 01:08:33 -04:00
case it's already being talked about.
2019-01-22 17:01:33 -05:00
## Bug Reports
Please let us know about what problems you run into, whether in behavior or
ergonomics of API. You can do this by opening an [issue][new issue]. It's
2024-06-02 01:08:33 -04:00
helpful to look through [all issues][all issues] in case it's already being
2019-01-22 17:01:33 -05:00
talked about.
## Pull Requests
Looking for an idea? Check our [issues][issues]. If it's look more open ended,
it is probably best to post on the issue how you are thinking of resolving the
issue so you can get feedback early in the process. We want you to be
successful and it can be discouraging to find out a lot of re-work is needed.
Already have an idea? It might be good to first [create an issue][new issue]
to propose it so we can make sure we are aligned and lower the risk of having
to re-work some of it and the discouragement that goes along with that.
2021-07-27 16:22:17 -04:00
### Updating the Dictionary
2023-03-13 16:05:30 -04:00
`typos` dictionary is a mapping of typos to a list of possible corrections (see [Design ](docs/design.md )).
If you aren't in a hurry, [we have a pinned
Issue](https://github.com/crate-ci/typos/issues) to collect dictionary changes
to be done in bulk in an attempt to lower the barrier for improving the dictionary.
Otherwise, to add to the dictionary:
2021-07-27 14:14:30 -04:00
2022-04-25 07:17:39 -04:00
1. Add your typo to our data file `crates/typos-dict/assets/words.csv`
2021-07-27 14:14:30 -04:00
Format: `typo,correction[,correction...]`
2022-08-13 10:36:55 -04:00
2. Code-gen the dictionary
2021-07-27 14:14:30 -04:00
2023-01-24 09:54:08 -05:00
With `cargo` and `rustfmt` installed, run
2022-08-13 10:36:55 -04:00
```console
$ SNAPSHOTS=overwrite cargo test --workspace
2021-07-27 14:14:30 -04:00
```
2022-08-13 10:36:55 -04:00
(we do development-time code-gen to speed up builds)
2021-07-27 14:14:30 -04:00
2022-08-13 10:36:55 -04:00
3. Verify your change
2021-07-27 14:14:30 -04:00
Run
2022-08-13 10:36:55 -04:00
```console
$ cargo test --workspace
2021-07-27 14:14:30 -04:00
```
2022-08-13 10:36:55 -04:00
Auto-cleans up your change according to some rules we have like:
- Don't prefer specific dialects in the dictionary, leaving those to [`varcon` ](http://wordlist.aspell.net/varcon-readme/ ).
- Mixing up corrections and typos
- etc
2021-07-27 14:14:30 -04:00
2019-01-22 17:01:33 -05:00
### Process
As a heads up, we'll be running your PR through the following gauntlet:
- warnings turned to compile errors
- `cargo test`
- `rustfmt`
- `clippy`
- `rustdoc`
2024-07-04 13:06:12 -04:00
- [`committed` ](https://github.com/crate-ci/committed ) as we use [Conventional ](https://www.conventionalcommits.org ) commit style
2024-07-04 12:54:40 -04:00
- [`typos` ](https://github.com/crate-ci/typos ) to check spelling
Not everything can be checked automatically though.
2024-07-04 13:06:12 -04:00
We request that the commit history gets cleaned up.
2024-07-04 12:54:40 -04:00
We ask that commits are atomic, meaning they are complete and have a single responsibility.
2024-07-04 13:06:12 -04:00
PRs should tell a cohesive story, with test and refactor commits that keep the
2024-07-04 12:54:40 -04:00
fix or feature commits simple and clear.
2024-08-23 20:02:02 -04:00
Specifically, we would encourage
2024-07-04 12:54:40 -04:00
- File renames be isolated into their own commit
- Add tests in a commit before their feature or fix, showing the current behavior.
The diff for the feature/fix commit will then show how the behavior changed,
2024-11-29 09:16:58 -05:00
making it clearer to reviewers and the community and showing people that the
2024-07-04 12:54:40 -04:00
test is verifying the expected state.
- e.g. [clap#5520 ](https://github.com/clap-rs/clap/pull/5520 )
Note that we are talking about ideals.
We understand having a clean history requires more advanced git skills;
feel free to ask us for help!
We might even suggest where it would work to be lax.
We also understand that editing some early commits may cause a lot of churn
with merge conflicts which can make it not worth editing all of the history.
For code organization, we recommend
- Grouping `impl` blocks next to their type (or trait)
- Grouping private items after the `pub` item that uses them.
- The intent is to help people quickly find the "relevant" details, allowing them to "dig deeper" as needed. Or put another way, the `pub` items serve as a table-of-contents.
- The exact order is fuzzy; do what makes sense
2019-01-22 17:01:33 -05:00
## Releasing
When we're ready to release, a project owner should do the following
- Determine what the next version is, according to semver
- Bump version in a commit
- Update CHANGELOG.md
- Update the version in `Cargo.toml`
- Update the dependency version in `src/lib.rs`
- Update the dependency version in `README.md`
- Tag the commit via `git tag -am "v<X>.<Y>.<Z>" v<X>.<Y>.<Z>`
- `git push upstream master --tag v<X>.<Y>.<Z>`
- Run `cargo publish` (run `cargo login` first if needed)
2019-10-25 11:58:24 -04:00
[issues]: https://github.com/crate-ci/typos/issues
[new issue]: https://github.com/crate-ci/typos/issues/new
[all issues]: https://github.com/crate-ci/typos/issues?utf8=%E2%9C%93& q=is%3Aissue
2023-02-09 18:12:14 -05:00
[CI]: https://github.com/crate-ci/typos/tree/master/.github/workflows