|
| 1 | +Welcome! Thanks for looking into contributing to our project! |
| 2 | + |
| 3 | +# Table of Contents |
| 4 | + |
| 5 | +- [Looking for Help?](#looking-for-help) |
| 6 | + - [Documentation](#documentation) |
| 7 | + - [Chat Rooms](#chat-rooms) |
| 8 | +- [Reporting Issues](#reporting-issues) |
| 9 | +- [Submitting Code](#submitting-code) |
| 10 | + - [Coding Style](#coding-style) |
| 11 | + - [Submitting PRs](#submitting-prs) |
| 12 | + - [Where do I start?](#where-do-i-start) |
| 13 | +- [Testing](#testing) |
| 14 | +- [LLM Contributions](#llm-contributions) |
| 15 | + - [Project-related use of LLMs](#project-related-use-of-llms) |
| 16 | + |
| 17 | +# Looking for Help? |
| 18 | + |
| 19 | +Here is a list of helpful resources you can consult: |
| 20 | + |
| 21 | +## Documentation |
| 22 | + |
| 23 | +- [Matrix spec Documentation](https://spec.matrix.org/latest/) |
| 24 | +- [Ruma Documentation](https://docs.rs/ruma/latest/ruma/) |
| 25 | + |
| 26 | +## Chat Rooms |
| 27 | + |
| 28 | +- Ruma Matrix room: [#ruma:matrix.org](https://matrix.to/#/#ruma:matrix.org) |
| 29 | +- Ruma Development Matrix room: [#ruma-dev:matrix.org](https://matrix.to/#/#ruma-dev:matrix.org) |
| 30 | +- Matrix Developer room: [#matrix-dev:matrix.org](https://matrix.to/#/#matrix-dev:matrix.org) |
| 31 | + |
| 32 | +# Reporting Issues |
| 33 | + |
| 34 | +If you find any bugs, inconsistencies or other problems, feel free to submit |
| 35 | +a GitHub [issue](https://github.com/ruma/examples/issues/new). |
| 36 | + |
| 37 | +If you have a quick question, it may be easier to leave a message in |
| 38 | +[#ruma:matrix.org](https://matrix.to/#/#ruma:matrix.org). |
| 39 | + |
| 40 | +Also, if you have trouble getting on board, let us know so we can help future |
| 41 | +contributors to the project overcome that hurdle too. |
| 42 | + |
| 43 | +# Submitting Code |
| 44 | + |
| 45 | +Ready to write some code? Great! Here are some guidelines to follow to |
| 46 | +help you on your way: |
| 47 | + |
| 48 | +## Coding Style |
| 49 | + |
| 50 | +In general, try to replicate the coding style that is already present. Specifically: |
| 51 | + |
| 52 | +### Code Formatting and Linting |
| 53 | + |
| 54 | +We use [rustfmt] to ensure consistent formatting code and [clippy] to catch |
| 55 | +common mistakes not caught by the compiler as well as enforcing a few custom |
| 56 | +code style choices. |
| 57 | + |
| 58 | +```sh |
| 59 | +# if you don't have them installed, install or update the nightly toolchain |
| 60 | +rustup install nightly |
| 61 | +# … and install prebuilt rustfmt and clippy executables (available for most platforms) |
| 62 | +rustup component add rustfmt clippy |
| 63 | +``` |
| 64 | + |
| 65 | +Before committing your changes, run `cargo +nightly fmt` to format the code (if |
| 66 | +your editor / IDE isn't set up to run it automatically) and |
| 67 | +`cargo +nightly clippy --workspace`¹ to run lints. |
| 68 | + |
| 69 | +¹ If you modified feature-gated code (`#[cfg(feature = "something")]`), you |
| 70 | +have to pass `--all-features` or `--features something` to clippy for it to |
| 71 | +check that code |
| 72 | + |
| 73 | +[rustfmt]: https://github.com/rust-lang/rustfmt#readme |
| 74 | +[clippy]: https://github.com/rust-lang/rust-clippy#readme |
| 75 | + |
| 76 | +### Import Formatting |
| 77 | + |
| 78 | +Organize your imports into three groups separated by blank lines: |
| 79 | + |
| 80 | +1. `std` imports |
| 81 | +1. External imports (from other crates) |
| 82 | +1. Local imports (`self::`, `super::`, `crate::` and things like `LocalEnum::*`) |
| 83 | + |
| 84 | +For example, |
| 85 | + |
| 86 | +```rust |
| 87 | +use std::collections::BTreeMap; |
| 88 | + |
| 89 | +use ruma_common::api::ruma_api; |
| 90 | + |
| 91 | +use super::MyType; |
| 92 | +``` |
| 93 | + |
| 94 | +### Commit Messages |
| 95 | + |
| 96 | +The commit message should start with the _area_ that is affected by the change. |
| 97 | +An area is usually the name of the affected example. For example, the |
| 98 | +description of a commit that affects the hello_world example should look like |
| 99 | +"hello-world: Add new event". |
| 100 | + |
| 101 | +Write commit messages using the imperative mood, as if completing the sentence: |
| 102 | +"If applied, this commit will \_\_\_." For example, use "Fix some bug" instead |
| 103 | +of "Fixed some bug" or "Add a feature" instead of "Added a feature". |
| 104 | + |
| 105 | +(Take a look at this |
| 106 | +[blog post](https://www.freecodecamp.org/news/writing-good-commit-messages-a-practical-guide/) |
| 107 | +for more information on writing good commit messages.) |
| 108 | + |
| 109 | +## Submitting PRs |
| 110 | + |
| 111 | +Once you're ready to submit your code, create a pull request, and one of our |
| 112 | +maintainers will review it. Once your PR has passed review, a maintainer will |
| 113 | +merge the request and you're done! 🎉 |
| 114 | + |
| 115 | +## Where do I start? |
| 116 | + |
| 117 | +If this is your first contribution to the project, we recommend taking a look |
| 118 | +at one of the [open issues][] we've marked for new contributors. |
| 119 | + |
| 120 | +[open issues]: https://github.com/ruma/examples/issues?q=is%3Aissue+is%3Aopen+label%3A"help+wanted" |
| 121 | + |
| 122 | +# Testing |
| 123 | + |
| 124 | +Before committing, run `cargo check` to make sure that your changes can build, |
| 125 | +as well as running the formatting and linting tools |
| 126 | +[mentioned above](#code-formatting-and-linting). |
| 127 | + |
| 128 | +# LLM Contributions |
| 129 | + |
| 130 | +Contributions must not include content generated by large language models |
| 131 | +or other probabilistic tools like ChatGPT, Claude, and Copilot. |
| 132 | + |
| 133 | +This policy exists due to |
| 134 | + |
| 135 | +- ethical concerns about the data gathering for training these models |
| 136 | +- the disproportionate use of electricity and water of building / running them |
| 137 | +- the potential negative influence of LLM-generated content on quality |
| 138 | +- potential copyright violations |
| 139 | + |
| 140 | +This ban of LLM-generated content applies to all parts of the projects, |
| 141 | +including, but not limited to, code, documentation, issues, and artworks. |
| 142 | +An exception applies for purely translating texts for issues and comments to |
| 143 | +English. We may make more exceptions for other accessibility-related uses. |
| 144 | + |
| 145 | +## Project-related use of LLMs |
| 146 | + |
| 147 | +We heavily discourage the use of LLM chat bots as a replacement for reading |
| 148 | +Ruma's documentation and API reference. |
| 149 | + |
| 150 | +Support requests referencing misleading or false LLM output relating to the |
| 151 | +project may be ignored, since it is a waste of time for us to "debug" where |
| 152 | +things went wrong based on this output before human support was sought. |
0 commit comments