Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: format the markdown and lint against it in ci #1829

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .dprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"lineWidth": 80,
"markdown": {
"lineWidth": 80,
"emphasisKind": "asterisks",
"strongKind": "asterisks",
"textWrap": "always"
},
"toml": {
"lineWidth": 80
},
"json": {
"lineWidth": 80,
"indentWidth": 4
},
"includes": [
"**/*.{md}",
"**/*.{toml}",
"**/*.{json}",
"**/*.{js,ts,tsx,jsx}"
],
"excludes": [
"book/**/book.js",
"theme/book.js",
"target/**/*"
],
"exec": {
"commands": [{
"command": "rustfmt --edition 2021",
"exts": ["rs"]
}]
},
"plugins": [
"https://plugins.dprint.dev/markdown-0.16.4.wasm",
"https://plugins.dprint.dev/toml-0.6.1.wasm",
"https://plugins.dprint.dev/json-0.19.2.wasm",
"https://plugins.dprint.dev/typescript-0.89.3.wasm",
"https://plugins.dprint.dev/exec-0.4.4.json@c207bf9b9a4ee1f0ecb75c594f774924baf62e8e53a2ce9d873816a408cecbf7"
]
}
23 changes: 23 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint with dprint

on:
push:
branches: [main]
pull_request:

jobs:
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Update rustup
run: rustup self update

- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain install stable -c rustfmt
rustup default stable

- uses: dprint/[email protected]
98 changes: 77 additions & 21 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,95 @@
# The Rust Code of Conduct

A version of this document [can be found online](https://www.rust-lang.org/conduct.html).
A version of this document
[can be found online](https://www.rust-lang.org/conduct.html).

## Conduct

**Contact**: [[email protected]](mailto:[email protected])

* We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other similar characteristic.
* On IRC, please avoid using overtly sexual nicknames or other nicknames that might detract from a friendly, safe and welcoming environment for all.
* Please be kind and courteous. There's no need to be mean or rude.
* Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.
* Please keep unstructured critique to a minimum. If you have solid ideas you want to experiment with, make a fork and see how it works.
* We will exclude you from interaction if you insult, demean or harass anyone. That is not welcome behavior. We interpret the term "harassment" as including the definition in the [Citizen Code of Conduct](http://citizencodeofconduct.org/); if you have any lack of clarity about what might be included in that concept, please read their definition. In particular, we don't tolerate behavior that excludes people in socially marginalized groups.
* Private harassment is also unacceptable. No matter who you are, if you feel you have been or are being harassed or made uncomfortable by a community member, please contact one of the channel ops or any of the [Rust moderation team][mod_team] immediately. Whether you're a regular contributor or a newcomer, we care about making this community a safe place for you and we've got your back.
* Likewise any spamming, trolling, flaming, baiting or other attention-stealing behavior is not welcome.
- We are committed to providing a friendly, safe and welcoming environment for
all, regardless of level of experience, gender identity and expression, sexual
orientation, disability, personal appearance, body size, race, ethnicity, age,
religion, nationality, or other similar characteristic.
- On IRC, please avoid using overtly sexual nicknames or other nicknames that
might detract from a friendly, safe and welcoming environment for all.
- Please be kind and courteous. There's no need to be mean or rude.
- Respect that people have differences of opinion and that every design or
implementation choice carries a trade-off and numerous costs. There is seldom
a right answer.
- Please keep unstructured critique to a minimum. If you have solid ideas you
want to experiment with, make a fork and see how it works.
- We will exclude you from interaction if you insult, demean or harass anyone.
That is not welcome behavior. We interpret the term "harassment" as including
the definition in the
[Citizen Code of Conduct](http://citizencodeofconduct.org/); if you have any
lack of clarity about what might be included in that concept, please read
their definition. In particular, we don't tolerate behavior that excludes
people in socially marginalized groups.
- Private harassment is also unacceptable. No matter who you are, if you feel
you have been or are being harassed or made uncomfortable by a community
member, please contact one of the channel ops or any of the
[Rust moderation team][mod_team] immediately. Whether you're a regular
contributor or a newcomer, we care about making this community a safe place
for you and we've got your back.
- Likewise any spamming, trolling, flaming, baiting or other attention-stealing
behavior is not welcome.

## Moderation

These are the policies for upholding our community's standards of conduct. If you feel that a thread needs moderation, please contact the [Rust moderation team][mod_team].
These are the policies for upholding our community's standards of conduct. If
you feel that a thread needs moderation, please contact the
[Rust moderation team][mod_team].

1. Remarks that violate the Rust standards of conduct, including hateful, hurtful, oppressive, or exclusionary remarks, are not allowed. (Cursing is allowed, but never targeting another user, and never in a hateful manner.)
2. Remarks that moderators find inappropriate, whether listed in the code of conduct or not, are also not allowed.
1. Remarks that violate the Rust standards of conduct, including hateful,
hurtful, oppressive, or exclusionary remarks, are not allowed. (Cursing is
allowed, but never targeting another user, and never in a hateful manner.)
2. Remarks that moderators find inappropriate, whether listed in the code of
conduct or not, are also not allowed.
3. Moderators will first respond to such remarks with a warning.
4. If the warning is unheeded, the user will be "kicked," i.e., kicked out of the communication channel to cool off.
5. If the user comes back and continues to make trouble, they will be banned, i.e., indefinitely excluded.
6. Moderators may choose at their discretion to un-ban the user if it was a first offense and they offer the offended party a genuine apology.
7. If a moderator bans someone and you think it was unjustified, please take it up with that moderator, or with a different moderator, **in private**. Complaints about bans in-channel are not allowed.
8. Moderators are held to a higher standard than other community members. If a moderator creates an inappropriate situation, they should expect less leeway than others.
4. If the warning is unheeded, the user will be "kicked," i.e., kicked out of
the communication channel to cool off.
5. If the user comes back and continues to make trouble, they will be banned,
i.e., indefinitely excluded.
6. Moderators may choose at their discretion to un-ban the user if it was a
first offense and they offer the offended party a genuine apology.
7. If a moderator bans someone and you think it was unjustified, please take it
up with that moderator, or with a different moderator, **in private**.
Complaints about bans in-channel are not allowed.
8. Moderators are held to a higher standard than other community members. If a
moderator creates an inappropriate situation, they should expect less leeway
than others.

In the Rust community we strive to go the extra step to look out for each other. Don't just aim to be technically unimpeachable, try to be your best self. In particular, avoid flirting with offensive or sensitive issues, particularly if they're off-topic; this all too often leads to unnecessary fights, hurt feelings, and damaged trust; worse, it can drive people away from the community entirely.
In the Rust community we strive to go the extra step to look out for each other.
Don't just aim to be technically unimpeachable, try to be your best self. In
particular, avoid flirting with offensive or sensitive issues, particularly if
they're off-topic; this all too often leads to unnecessary fights, hurt
feelings, and damaged trust; worse, it can drive people away from the community
entirely.

And if someone takes issue with something you said or did, resist the urge to be defensive. Just stop doing what it was they complained about and apologize. Even if you feel you were misinterpreted or unfairly accused, chances are good there was something you could've communicated better — remember that it's your responsibility to make your fellow Rustaceans comfortable. Everyone wants to get along and we are all here first and foremost because we want to talk about cool technology. You will find that people will be eager to assume good intent and forgive as long as you earn their trust.
And if someone takes issue with something you said or did, resist the urge to be
defensive. Just stop doing what it was they complained about and apologize. Even
if you feel you were misinterpreted or unfairly accused, chances are good there
was something you could've communicated better — remember that it's your
responsibility to make your fellow Rustaceans comfortable. Everyone wants to get
along and we are all here first and foremost because we want to talk about cool
technology. You will find that people will be eager to assume good intent and
forgive as long as you earn their trust.

The enforcement policies listed above apply to all official Rust venues; including official IRC channels (#rust, #rust-internals, #rust-tools, #rust-libs, #rustc, #rust-beginners, #rust-docs, #rust-community, #rust-lang, and #cargo); GitHub repositories under rust-lang, rust-lang-nursery, and rust-lang-deprecated; and all forums under rust-lang.org (users.rust-lang.org, internals.rust-lang.org). For other projects adopting the Rust Code of Conduct, please contact the maintainers of those projects for enforcement. If you wish to use this code of conduct for your own project, consider explicitly mentioning your moderation policy or making a copy with your own moderation policy so as to avoid confusion.
The enforcement policies listed above apply to all official Rust venues;
including official IRC channels (#rust, #rust-internals, #rust-tools,
#rust-libs, #rustc, #rust-beginners, #rust-docs, #rust-community, #rust-lang,
and #cargo); GitHub repositories under rust-lang, rust-lang-nursery, and
rust-lang-deprecated; and all forums under rust-lang.org (users.rust-lang.org,
internals.rust-lang.org). For other projects adopting the Rust Code of Conduct,
please contact the maintainers of those projects for enforcement. If you wish to
use this code of conduct for your own project, consider explicitly mentioning
your moderation policy or making a copy with your own moderation policy so as to
avoid confusion.

*Adapted from the [Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling) as well as the [Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).*
*Adapted from the
[Node.js Policy on Trolling](http://blog.izs.me/post/30036893703/policy-on-trolling)
as well as the
[Contributor Covenant v1.3.0](https://www.contributor-covenant.org/version/1/3/0/).*

[mod_team]: https://www.rust-lang.org/team.html#Moderation-team
37 changes: 19 additions & 18 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Rust by Example contribution guidelines

Thank you for your interest in making Rust by Example (also known as RBE)
better! We'd love to have your contribution. We expect all contributors to
abide by the [Rust code of conduct], which you can find at that link or in the
better! We'd love to have your contribution. We expect all contributors to abide
by the [Rust code of conduct], which you can find at that link or in the
[`CODE_OF_CONDUCT.md`] file in this repository.

[Rust code of conduct]: https://www.rust-lang.org/policies/code-of-conduct
Expand All @@ -23,24 +23,24 @@ To make changes to RBE, please send in pull requests on GitHub to the `master`
branch. We'll review them and either merge or request changes. Travis CI tests
everything as well, so you may get feedback from it too.

If you make additions or other changes to a pull request, feel free to either amend
previous commits or only add new ones, however you prefer. We may ask you to squash
your commits before merging, depending.
If you make additions or other changes to a pull request, feel free to either
amend previous commits or only add new ones, however you prefer. We may ask you
to squash your commits before merging, depending.

## Issue Tracker

You can find the issue tracker [on
GitHub](https://github.com/rust-lang/rust-by-example/issues). If you've found a
problem with RBE, please open an issue there.
You can find the issue tracker
[on GitHub](https://github.com/rust-lang/rust-by-example/issues). If you've
found a problem with RBE, please open an issue there.

We use the following labels:

* `enhancement`: This is for any request for new sections or functionality.
* `bug`: This is for anything that's in RBE, but incorrect or not working.
* `discussion`: A discussion about improving something in RBE; this may lead to new
enhancement or bug issues.
* `E-mentor`: This issue has someone dedicated to helping a new contributor fix it!
Can apply to both enhancement or bug issues.
- `enhancement`: This is for any request for new sections or functionality.
- `bug`: This is for anything that's in RBE, but incorrect or not working.
- `discussion`: A discussion about improving something in RBE; this may lead to
new enhancement or bug issues.
- `E-mentor`: This issue has someone dedicated to helping a new contributor fix
it! Can apply to both enhancement or bug issues.

## Development workflow

Expand All @@ -63,14 +63,15 @@ $ mdbook build
[install Rust]: http://rust-lang.org/install.html

The files will be in the `book` directory at the top-level; `mdbook serve` will
open the contents in your web browser ([localhost:3000](http://localhost:3000) by default).
open the contents in your web browser ([localhost:3000](http://localhost:3000)
by default).

To run the tests:

```bash
$ mdbook test
```

If you're adding a new chapter, you'll need to edit `src\SUMMARY.md` to add it. If
you're tweaking an existing example, you'll need to edit the corresponding file; check
`src\SUMMARY.md` to see a mapping of where chapters go to files.
If you're adding a new chapter, you'll need to edit `src\SUMMARY.md` to add it.
If you're tweaking an existing example, you'll need to edit the corresponding
file; check `src\SUMMARY.md` to see a mapping of where chapters go to files.
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Learn Rust with examples (Live code editor included)

## Using

If you'd like to read Rust by Example, you can visit <https://doc.rust-lang.org/rust-by-example/>
to read it online.
If you'd like to read Rust by Example, you can visit
<https://doc.rust-lang.org/rust-by-example/> to read it online.

If you'd like to read it locally, [install Rust], and then:

Expand All @@ -36,7 +36,8 @@ read all content offline, however!

### Using translated version

If there is a translated resource in `po/` directory, it can be specified through `MDBOOK_BOOK__LANGUAGE` like below:
If there is a translated resource in `po/` directory, it can be specified
through `MDBOOK_BOOK__LANGUAGE` like below:

```bash
git clone https://github.com/rust-lang/rust-by-example
Expand All @@ -60,31 +61,31 @@ Please see the [TRANSLATING.md] file for more details.

### Translating guide for each languages

* Japanese/日本語: [TRANSLATING_JA.md]
- Japanese/日本語: [TRANSLATING_JA.md]

[TRANSLATING_JA.md]: https://github.com/rust-lang/rust-by-example/blob/master/TRANSLATING_JA.md

## Translations to other languages

* [Bulgarian](https://github.com/kberov/rust-by-example-bg)
* [Chinese](https://github.com/rust-lang-cn/rust-by-example-cn)
* [Japanese](https://github.com/rust-lang-ja/rust-by-example-ja)
* [French](https://github.com/Songbird0/FR_RBE)
* [Russian](https://github.com/ruRust/rust-by-example)
* [Vietnamese](https://github.com/EyesCrypto-Insights/rust-by-example-vn)
* [Portuguese](https://github.com/nazarepiedady/rust-com-exemplos)
- [Bulgarian](https://github.com/kberov/rust-by-example-bg)
- [Chinese](https://github.com/rust-lang-cn/rust-by-example-cn)
- [Japanese](https://github.com/rust-lang-ja/rust-by-example-ja)
- [French](https://github.com/Songbird0/FR_RBE)
- [Russian](https://github.com/ruRust/rust-by-example)
- [Vietnamese](https://github.com/EyesCrypto-Insights/rust-by-example-vn)
- [Portuguese](https://github.com/nazarepiedady/rust-com-exemplos)

## License

Rust by Example is licensed under either of

* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
<http://www.apache.org/licenses/LICENSE-2.0>)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
- MIT license ([LICENSE-MIT](LICENSE-MIT) or
<http://opensource.org/licenses/MIT>)

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in Rust by Example by you, as defined in the Apache-2.0 license, shall be
dually licensed as above, without any additional terms or conditions.
for inclusion in Rust by Example by you, as defined in the Apache-2.0 license,
shall be dually licensed as above, without any additional terms or conditions.
Loading
Loading