This PR introduces two configuration files, .editorconfig and rustfmt.toml, to enforce consistent code formatting across the project. These additions aim to standardize indentation, line endings, maximum line length, and other formatting rules for Rust and Python files, ensuring the codebase is uniform and easier to maintain.
Key Changes
.editorconfig:
Specifies global formatting rules, including indentation style, end-of-line characters, and character encoding.
Defines specific configurations for Python and Rust files, such as maximum line length.
rustfmt.toml:
Sets Rust-specific formatting rules, focusing on indentation, tab spaces, maximum line width, and newline style.
Promotes code readability and consistency across Rust files.
.editorconfig Configuration
The .editorconfig file includes the following rules:
Global Settings:
indent_style = space: Use spaces for indentation.
indent_size = 2: Use 2 spaces per indentation level.
insert_final_newline = true: Ensure every file ends with a newline.
end_of_line = lf: Use Unix-style line endings.
charset = utf-8: Set UTF-8 as the default encoding.
Python Settings:
max_line_length = 88: Follows PEP 8 guidelines for Python files.
Rust Settings:
max_line_length = 100: Maximum line length for Rust files.
rustfmt.toml Configuration
The rustfmt.toml file includes the following rules:
max_width = 100: Maximum line width for Rust code.
hard_tabs = false: Use spaces, not tabs, for indentation.
tab_spaces = 2: Each tab equals 2 spaces.
newline_style = "Unix": Unix-style line endings.
Rationale
These configurations promote consistent code formatting, reducing inconsistencies across the codebase. By following these standards, the team can ensure that code reviews and merges proceed smoothly, minimizing formatting-related issues.
Instructions for Team Members
Editor Integration:
Ensure your IDE or code editor supports .editorconfig and rustfmt.toml.
Use cargo fmt:
After merging this PR, run cargo fmt to apply the Rust-specific formatting rules.
Automated Checks:
If using a continuous integration (CI) system, add a step to verify that Rust code is formatted with cargo fmt -- --check.
This PR introduces two configuration files,
.editorconfig
andrustfmt.toml
, to enforce consistent code formatting across the project. These additions aim to standardize indentation, line endings, maximum line length, and other formatting rules for Rust and Python files, ensuring the codebase is uniform and easier to maintain.Key Changes
.editorconfig
:rustfmt.toml
:.editorconfig
ConfigurationThe
.editorconfig
file includes the following rules:Global Settings:
indent_style = space
: Use spaces for indentation.indent_size = 2
: Use 2 spaces per indentation level.insert_final_newline = true
: Ensure every file ends with a newline.end_of_line = lf
: Use Unix-style line endings.charset = utf-8
: Set UTF-8 as the default encoding.Python Settings:
max_line_length = 88
: Follows PEP 8 guidelines for Python files.Rust Settings:
max_line_length = 100
: Maximum line length for Rust files.rustfmt.toml
ConfigurationThe
rustfmt.toml
file includes the following rules:max_width = 100
: Maximum line width for Rust code.hard_tabs = false
: Use spaces, not tabs, for indentation.tab_spaces = 2
: Each tab equals 2 spaces.newline_style = "Unix"
: Unix-style line endings.Rationale
These configurations promote consistent code formatting, reducing inconsistencies across the codebase. By following these standards, the team can ensure that code reviews and merges proceed smoothly, minimizing formatting-related issues.
Instructions for Team Members
Editor Integration: Ensure your IDE or code editor supports
.editorconfig
andrustfmt.toml
.Use
cargo fmt
: After merging this PR, runcargo fmt
to apply the Rust-specific formatting rules.Automated Checks: If using a continuous integration (CI) system, add a step to verify that Rust code is formatted with
cargo fmt -- --check
.