#+TITLE: How to contribute
#+AUTHOR: Simon Johnston
#+EMAIL: johnstonskj@gmail.com
#+LANGUAGE: en
#+STARTUP: overview hidestars inlineimages entitiespretty
#+OPTIONS: author:nil created:nil creator:nil date:nil email:nil num:3 toc:nil


I'm really glad you're reading this, because we need volunteer developers to
help this project continue to grow and improve.

1. File [[../../issues/new?assignees=&labels=bug&template=bug_report.md][bugs]] and [[../../issues/new?assignees=&labels=enhancement&template=feature_request.md][enhancement requests]].
2. Review the project documentation know if you find are issues, or missing
   content, there.
3. Fix or Add something and send us a pull request; you may like to pick up one of the issues marked [[../../labels/help%20wanted][help wanted]] or [[../../labels/good%20first%20issue][good
   first issue]] as an introduction. Alternatively, [[../../labels/documentation][documentation]] issues can be a great way to understand the project and
   help improve the developer experience.

* Submitting changes

We love pull requests from everyone. By participating in this project, you agree to abide by our [[./code_of_conduct.org][Code of Conduct]], and
[[../LICENSE][License]].

Fork, then clone the repo:

#+BEGIN_EXAMPLE bash
❯ git clone git@github.com:johnstonskj/rust-sdml.git
#+END_EXAMPLE

Ensure you have a good Rust install, usually managed by [[https://rustup.rs/][rustup]]. You can ensure the latest tools with the following:

#+BEGIN_EXAMPLE bash
❯ rustup update
#+END_EXAMPLE

Make your change. Add tests, and documentation, for your change. Ensure not only that tests pass, but the following all
run successfully.

#+BEGIN_EXAMPLE bash
❯ cargo check --workspace --all-targets --all-features
❯ cargo fmt --all -- --check
❯ cargo clippy --workspace --all-targets --all-features -- -D warnings
#+END_EXAMPLE

Make sure the tests pass. Note the three test passes which check for weird cases which can creap in with features.

#+BEGIN_EXAMPLE bash
❯ cargo test --workspace --no-fail-fast --all-features
❯ cargo test --workspace --no-fail-fast --all-targets --all-features
❯ cargo test --workspace --no-fail-fast --no-default-targets --all-features
❯ cargo doc --workspace --all-features --no-deps
#+END_EXAMPLE

If you made changes to the book source, ensure the following runs successfully

#+BEGIN_EXAMPLE bash
❯ mdbook build
#+END_EXAMPLE

If you have made any changes to =Cargo.toml=, also check:

#+BEGIN_EXAMPLE bash
❯ cargo audit
❯ cargo outdated --workspace --depth 1
#+END_EXAMPLE

Push to your fork and [[../../compare/][submit a pull request]] using our [[./pull_request_template.md][PR template]].

At this point you're waiting on us. We like to at least comment on pull requests within three business days (and,
typically, one business day). We may suggest some changes or improvements or alternatives.

Some things that will increase the chance that your pull request is accepted:

1. Write unit tests.
2. Write API documentation.
3. Write a [[https://cbea.ms/git-commit/https://cbea.ms/git-commit/][good commit message]].


* Coding conventions

The primary tool for coding conventions is rustfmt, and specifically =cargo
fmt= is a part of the build process and will cause Actions to fail.

DO NOT create or update any existing =rustfmt.toml= file to change the default
formatting rules.

DO NOT alter any =warn= or =deny= library attributes. 

DO NOT add any =feature= attributes that would prohibit building on the stable
channel. In some cases new crate-level features can be used to introduce an
unstable feature dependency but these MUST be clearly documented and optional.

DO NOT introduce =unsafe= code without a discussion on alternatives first.
Ideally any unsafe code will be introduced as optional features.
