Code style - softgitron/potku-console GitHub Wiki
Eetu Asikainen is responsible for the general code style of the project and thus all discussion regarding the rules outlined here should be with him. Failing to follow the guidelines here will result in a pull request being declined.
The project is programmed in Rust, so all code should comply with the Official Rust style guide with the exception of maximum line length being 120 characters, instead of 100 characters.
All code should strive to be tested. It's preferable to strictly adhere to standards of test driven development to achieve this, i.e. write tests before code. If there is an at all feasible way to cover the code with unit tests, the code should be covered with unit tests. According to the rust principles, these unit tests should be under the "tests"-module, in each file written.
On top of maximum achieveable unit test coverage, we strive for wide integration and system test coverage. These should live in a "tests" folder, under each specific module.
Always open a new issue for any TODO-comments left in the code and indicate the issue in the TODO comment.
Only use doc comments for functions exposed to the public API. Adhere to Rust guidelines regaring using inner doc comments (//!
). As a result of this, all functions should be documented by their name alone. Prefer splitting functions into smaller ones to achieve this, instead of writing longer names.