Thank you for considering contributing to the weather-rs project! We appreciate your interest in making this project even better. To ensure a smooth and collaborative contribution process, please follow the guidelines below.
Please follow the Rust Code Convention while writing code. This helps maintain consistency and readability throughout the codebase.
We recommend using the Clippy tool to ensure code quality. Running Clippy checks can help catch potential issues and improve code clarity.
When contributing to the codebase, adhere to the KISS and SRP principles. Keep code simple and ensure that each module, function, or method has a single responsibility, making the codebase more maintainable and understandable.
To enhance navigation within the codebase, please follow this recommended initialization order when writing code in Rust files:
- Module export and reexport using the
mod
keyword. - Import external crates.
- Import internal crates or modules.
- Define constants and static values.
- Define error enums.
- Define enums.
- Define traits.
- Define structs along with their associated functions, methods, and trait implementations.
- Define functions.
- Define test functions.
This suggested order is not a strict rule but helps make the code more organized and easier to navigate.
To maintain code quality and ensure that new contributions do not introduce regressions, please follow these guidelines for testing:
- Run
cargo test
for all packages in the workspace to check for regressions across the entire project. - If you are working on a specific package within the workspace, run
cargo test -p <package_name>
to focus on testing that package.
For testing, the codebase uses the following conventions:
- Use
rstest
for test cases. - Use
tokio::test
for asynchronous testing. - Submodules used for testing specific parts of the program should have names like
tests_<name_of_module_or_struct
. - Test function, associative function, or method names should follow the pattern
test_<name_of_function_or_method>_<expected_result_or_condition>
.
Please note that while there are not many strict rules currently, they may be subject to change in the future. It's essential to stay updated with the project's documentation and discussions for any potential rule changes or additions.
We appreciate your contributions and adherence to these guidelines, as they help maintain a high-quality and well-organized codebase. Thank you for being a part of the weather-rs project! 🌦️