-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
📝 Add docs for contributing and private items (#26)
Hello! I took some time between my last PR and this one because I was documenting everything on the code 😍 . This is the list of contributions, I would like to hear the thoughts of @fdncred and @amtoine about them before merging this PR: - `docs/CONTRIBUTION.md` added. I explained the why and the how to contribute, and appended a list of general guidelines about the philosophy of the project: > - Everything should be explained: rust docs, comments, drawings, pick what makes you comfortable, but it is important to make it clear. There will always be some new guy or gal into the project we want to welcome 😄. > - Use clear variable names and try to avoid confusing abbreviations. Think that your peers may not be fully fluent in english 💬. - I added a few clippy lints from `clippy:pedantic`, [here](4b97279#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R6) are them: Clippy will give a warning if one if them is not compliant. I added these rules because I would like to improve the quality of upcoming contributions. I'm not sure if this is asking too much from the people who want to be involved in the project, as some of the rules may be a bit annoying. Do you see it doable? Do you think we should delete some or all of the clippy lints?
- Loading branch information
Showing
9 changed files
with
183 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,18 @@ jobs: | |
- name: Setup Rust toolchain and cache | ||
uses: actions-rust-lang/[email protected] | ||
- name: Clippy | ||
run: cargo clippy --no-deps | ||
run: | | ||
cargo clippy \ | ||
--no-deps \ | ||
-- \ | ||
-D rustdoc::broken_intra_doc_links \ | ||
-W missing_docs \ | ||
-W clippy::missing_docs_in_private_items \ | ||
-W clippy::explicit_iter_loop \ | ||
-W clippy::explicit_into_iter_loop \ | ||
-W clippy::semicolon_if_nothing_returned \ | ||
-W clippy::doc_markdown \ | ||
-W clippy::manual_let_else | ||
test: | ||
name: test rust files | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,18 @@ jobs: | |
- name: Setup Rust toolchain and cache | ||
uses: actions-rust-lang/[email protected] | ||
- name: Clippy | ||
run: cargo clippy --no-deps | ||
run: | | ||
cargo clippy \ | ||
--no-deps \ | ||
-- \ | ||
-D rustdoc::broken_intra_doc_links \ | ||
-W missing_docs \ | ||
-W clippy::missing_docs_in_private_items \ | ||
-W clippy::explicit_iter_loop \ | ||
-W clippy::explicit_into_iter_loop \ | ||
-W clippy::semicolon_if_nothing_returned \ | ||
-W clippy::doc_markdown \ | ||
-W clippy::manual_let_else | ||
test: | ||
name: test rust files | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Contributing to `nufmt` | ||
|
||
Salutations! Thanks for coming by and the interest into this project! | ||
We would like to order the contributions like this: | ||
|
||
- Before you start hacking, it is important to **ask first** if your idea or bugfix is in order. | ||
Create an issue or come and say hi in the [`#nufmt` channel][nufmt discord channel] by joining [the discord][Nushell discord]. | ||
We don't bite!. | ||
|
||
It would be sad that you do the effort to clone the project, successfully make the PR, but it wasn't in our plans or there is another PR that is currently adressing that issue. | ||
|
||
- After the PR is submitted, the workflows will start to lint, check and test the changes. Please try to stay all green ✅. | ||
- Sometimes we can take some time to respond. Sorry, we are few and there is much to do here! | ||
|
||
## General guidelines and philosophy | ||
|
||
This is a list of things we would like to have and mantain across time. Please do your best to abide by. | ||
|
||
- Everything should be explained: rust docs, drawings, markdown files, pick what makes you comfortable, but it is important to make it clear. There will always be some new guy or gal into the project we want to welcome 😄. | ||
- Use clear variable names and try to avoid confusing abbreviations. Think that your peers may not be fully fluent in english 💬. | ||
|
||
[Nushell discord]: https://discord.gg/NtAbbGn | ||
[nufmt discord channel]: https://discord.com/channels/601130461678272522/1117921521520873623 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# this module regroups a bunch of development tools to make the development | ||
# process easier for anyone. | ||
# | ||
# the main purpose of `toolkit` is to offer an easy to use interface for the | ||
# developer during a PR cycle, namely to (**1**) format the source base, | ||
# (**2**) catch classical flaws in the new changes with *clippy* and (**3**) | ||
# make sure all the tests pass. | ||
|
||
# print the pipe input inside backticks, dimmed and italic, as a pretty command | ||
def pretty-print-command [] { | ||
$"`(ansi default_dimmed)(ansi default_italic)($in)(ansi reset)`" | ||
} | ||
|
||
# check standard code formatting and apply the changes | ||
export def fmt [ | ||
--check: bool # do not apply the format changes, only check the syntax | ||
--verbose: bool # print extra information about the command's progress | ||
] { | ||
if $verbose { | ||
print $"running ('toolkit fmt' | pretty-print-command)" | ||
} | ||
|
||
if $check { | ||
try { | ||
cargo fmt --all -- --check | ||
} catch { | ||
error make --unspanned { | ||
msg: $"\nplease run ('toolkit fmt' | pretty-print-command) to fix formatting!" | ||
} | ||
} | ||
} else { | ||
cargo fmt --all | ||
} | ||
} | ||
|
||
# check that you're using the standard code style | ||
# | ||
# > it is important to make `clippy` happy :relieved: | ||
export def clippy [ | ||
--verbose: bool # print extra information about the command's progress | ||
] { | ||
if $verbose { | ||
print $"running ('toolkit clippy' | pretty-print-command)" | ||
} | ||
|
||
try {( | ||
cargo clippy | ||
--workspace | ||
-- | ||
-D rustdoc::broken_intra_doc_links | ||
-W missing_docs | ||
-W clippy::missing_docs_in_private_items | ||
-W clippy::explicit_iter_loop | ||
-W clippy::explicit_into_iter_loop | ||
-W clippy::semicolon_if_nothing_returned | ||
-W clippy::doc_markdown | ||
-W clippy::manual_let_else | ||
)} catch { | ||
error make --unspanned { | ||
msg: $"\nplease fix the above ('clippy' | pretty-print-command) errors before continuing!" | ||
} | ||
} | ||
} | ||
|
||
# check that all the tests pass | ||
export def test [ | ||
--fast: bool # use the "nextext" `cargo` subcommand to speed up the tests (see [`cargo-nextest`](https://nexte.st/) and [`nextest-rs/nextest`](https://github.com/nextest-rs/nextest)) | ||
] { | ||
if $fast { | ||
cargo nextest run --all | ||
} else { | ||
cargo test --workspace | ||
} | ||
} | ||
|
||
export def main [] { help toolkit } |