diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5865a34..daeadf5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,28 +16,35 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 - - uses: dtolnay/rust-toolchain@stable + - name: Checkout repo + uses: actions/checkout@v6 + + - name: Install rust stable toolchain + uses: dtolnay/rust-toolchain@stable with: components: rustfmt - - run: cargo fmt -- --check + + - name: Run rustfmt + run: cargo fmt -- --check clippy: name: Run clippy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v6 - - uses: dtolnay/rust-toolchain@stable + - name: Checkout repo + uses: actions/checkout@v6 + + - name: Install rust stable toolchain + uses: dtolnay/rust-toolchain@stable with: components: clippy + - uses: Swatinem/rust-cache@v2 - - run: cargo clippy --all-targets -- -D warnings - typos: - name: Spell Check with Typos - runs-on: ubuntu-latest + - name: Run clippy + run: cargo clippy --all-targets -- -D warnings - steps: - - uses: actions/checkout@v6 - - uses: crate-ci/typos@v1.39.2 + style: + name: Style + uses: ruma/ruma/.github/workflows/style.yml@6fc96e3af47c05a096df2bf2428a9accfc9b73ed diff --git a/.rumdl.toml b/.rumdl.toml new file mode 100644 index 0000000..32bc08f --- /dev/null +++ b/.rumdl.toml @@ -0,0 +1,33 @@ +cache = false + +[per-file-ignores] +"crates/ruma-common/src/doc/*.md" = ["first-line-heading"] +"crates/ruma-client-api/src/doc/*.md" = ["first-line-heading"] +"crates/ruma-events/src/doc/*.md" = ["first-line-heading"] +"crates/ruma-macros/src/doc/*.md" = ["first-line-heading"] + +[code-block-style] +style = "fenced" + +[code-fence-style] +style = "backtick" + +[emphasis-style] +style = "underscore" + +[heading-style] +style = "atx" + +[line-length] +line-length = 100 +code-blocks = false +tables = false + +[ol-prefix] +style = "ordered" + +[strong-style] +style = "asterisk" + +[ul-style] +style = "dash" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 01083c0..9224b03 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,8 @@ +# Contributing + Welcome! Thanks for looking into contributing to our project! -# Table of Contents +## Table of Contents - [Looking for Help?](#looking-for-help) - [Documentation](#documentation) @@ -14,22 +16,22 @@ Welcome! Thanks for looking into contributing to our project! - [LLM Contributions](#llm-contributions) - [Project-related use of LLMs](#project-related-use-of-llms) -# Looking for Help? +## Looking for Help? Here is a list of helpful resources you can consult: -## Documentation +### Documentation - [Matrix spec Documentation](https://spec.matrix.org/latest/) - [Ruma Documentation](https://docs.rs/ruma/latest/ruma/) -## Chat Rooms +### Chat Rooms - Ruma Matrix room: [#ruma:matrix.org](https://matrix.to/#/#ruma:matrix.org) - Ruma Development Matrix room: [#ruma-dev:matrix.org](https://matrix.to/#/#ruma-dev:matrix.org) - Matrix Developer room: [#matrix-dev:matrix.org](https://matrix.to/#/#matrix-dev:matrix.org) -# Reporting Issues +## Reporting Issues If you find any bugs, inconsistencies or other problems, feel free to submit a GitHub [issue](https://github.com/ruma/examples/issues/new). @@ -40,16 +42,16 @@ If you have a quick question, it may be easier to leave a message in Also, if you have trouble getting on board, let us know so we can help future contributors to the project overcome that hurdle too. -# Submitting Code +## Submitting Code Ready to write some code? Great! Here are some guidelines to follow to help you on your way: -## Coding Style +### Coding Style In general, try to replicate the coding style that is already present. Specifically: -### Code Formatting and Linting +#### Code Formatting and Linting We use [rustfmt] to ensure consistent formatting code and [clippy] to catch common mistakes not caught by the compiler as well as enforcing a few custom @@ -73,13 +75,13 @@ check that code [rustfmt]: https://github.com/rust-lang/rustfmt#readme [clippy]: https://github.com/rust-lang/rust-clippy#readme -### Import Formatting +#### Import Formatting Organize your imports into three groups separated by blank lines: 1. `std` imports -1. External imports (from other crates) -1. Local imports (`self::`, `super::`, `crate::` and things like `LocalEnum::*`) +2. External imports (from other crates) +3. Local imports (`self::`, `super::`, `crate::` and things like `LocalEnum::*`) For example, @@ -91,7 +93,7 @@ use ruma_common::api::ruma_api; use super::MyType; ``` -### Commit Messages +#### Commit Messages The commit message should start with the _area_ that is affected by the change. An area is usually the name of the affected example. For example, the @@ -106,26 +108,26 @@ of "Fixed some bug" or "Add a feature" instead of "Added a feature". [blog post](https://www.freecodecamp.org/news/writing-good-commit-messages-a-practical-guide/) for more information on writing good commit messages.) -## Submitting PRs +### Submitting PRs Once you're ready to submit your code, create a pull request, and one of our maintainers will review it. Once your PR has passed review, a maintainer will merge the request and you're done! 🎉 -## Where do I start? +### Where do I start? If this is your first contribution to the project, we recommend taking a look at one of the [open issues][] we've marked for new contributors. [open issues]: https://github.com/ruma/examples/issues?q=is%3Aissue+is%3Aopen+label%3A"help+wanted" -# Testing +## Testing Before committing, run `cargo check` to make sure that your changes can build, as well as running the formatting and linting tools [mentioned above](#code-formatting-and-linting). -# LLM Contributions +## LLM Contributions Contributions must not include content generated by large language models or other probabilistic tools like ChatGPT, Claude, and Copilot. @@ -142,7 +144,7 @@ including, but not limited to, code, documentation, issues, and artworks. An exception applies for purely translating texts for issues and comments to English. We may make more exceptions for other accessibility-related uses. -## Project-related use of LLMs +### Project-related use of LLMs We heavily discourage the use of LLM chat bots as a replacement for reading Ruma's documentation and API reference. diff --git a/hello_world/README.md b/hello_world/README.md index 963bcc9..ec6c85e 100644 --- a/hello_world/README.md +++ b/hello_world/README.md @@ -1,7 +1,9 @@ +# Hello world + A simple example to demonstrate `ruma-client` functionality. Joins the given room and sends "Hello World!". -# Usage +## Usage You will need to use an existing account on a homeserver that allows login with a password. diff --git a/joke_bot/README.md b/joke_bot/README.md index 355852d..e150faf 100644 --- a/joke_bot/README.md +++ b/joke_bot/README.md @@ -1,6 +1,8 @@ +# Joke bot + A simple bot to demonstrate `ruma-client` functionality. Tells jokes when you ask for them. -# Usage +## Usage Create a file called `config` and populate it with the following values in `key=value` format: diff --git a/message_log/README.md b/message_log/README.md index 9c2bf8a..d599363 100644 --- a/message_log/README.md +++ b/message_log/README.md @@ -1,7 +1,9 @@ +# Message log + A simple example to demonstrate `ruma-client` functionality. Prints all the received text messages to stdout. -# Usage +## Usage You will need to use an existing account on a homeserver that allows login with a password.