🎉👍 First off, thanks for taking the time to contribute! 👍🎉
The following is a set of guidelines for contributing to coreutils. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
The Code of Conduct for this repository here
In the Issues tracker, click in the button New issue
, then select the Bug Report
option. After that, add the required information about the bug in the template, and submit.
In the Issues tracker, click in the button New issue
, then select the Feature request
option. After that, add the required information about the bug in the template, and submit.
After forking and making your changes, always make a Pull Request to the master
branch with a proper message saying what is changed.
- First line should always start with the name of the tool that the code is being modified, followed by
:
. - Reference issues and pull requests liberally after the first line.
Git Commit Messages Template
<TOOL/LIB>: <SUBMODULE>: <SUBSUBMODULE>: <MESSAGE>
Git Commit Messages Example
Core: Groups: Blablabla bla bla
Id: Implement flag '-a'
- Always use
clap
using the.template/src/cli.rs
as template. - Always create a
build.rs
that creates every shell completions. (template on.template/build.rs
) - Every argument have to have the
help
text. - Help messages should start with upper case letter and end with a dot.
- Every parameter have to have the
long
andshort
options. - Every tool messages should follow this format:
<tool>: <message>
or<tool>: <message>: <submessage>
- Every tool should have exit code the same as the original tools.
- Don't use nightly only features.
- The code must be formatted with this repository
rustfmt
configurationrustfmt.toml
, otherwise the CI will fail.- Install the toolchain with:
rustup toolchain install nightly
and then format your code withcargo +nightly fmt
. Be sure thatcargo +nightly fmt -- --check
doesn't print anything.
- Install the toolchain with:
- Main functions should be the first thing after global use statements and module statements (not module blocks).
- Documentation should always be included when needed, for both functions, methods, modules, etc.
- Tests, when possible, should always be included/updated with your changes.
- Always comment what you're doing if it's not obvious, should be before the code that need explaining.
- Try to be conservative about dependencies, only add if it is very necessary or if it will add good amount of ergonomics with few sub-dependencies. (you can check the dependency tree using
cargo-tree
crate)- As for dependencies versions, use
"~<Version>"
for crates below 1.0 and"^<Version>"
for crates above 1.0.
- As for dependencies versions, use
- Avoid unsafe Rust in the tools code, if necessary, add a function in
coreutils_core
crate with necessary abstractions.