Hello everyone! So this week in my class we had to configure our static site generators to be easier to contribute to. This included adding a CONTRIBUTING.md file and also default format styles etc.
STEP 1
The first thing I did was creating a rustfmt.toml file for default format styles. Rust makes it super easy so all I had was this file which is used via cargo fmt
max_width = 120
comment_width = 100
match_block_trailing_comma = true
STEP 2
I also created a clippy.toml file however it is blank since the defaults for clippy are pretty sane already and I have no need to modify it. I still created the file however to signify that we do use cargo clippy
to lint our files.
Step 3
I then created a .vscode folder with a settings.json file that held only 1 line. Which is to format on save for vscode users. (I use neovim). Hopefully I did that correctly...
{ "editor.formatOnSave": true }
Step 4
I then finally bundled the information into the CONTRIBUTING.md file and linked it in my README.md. The commit can be found here
Final Thoughts
This lab made me really appreciate rust's first class support for in built tools to format and lint code easily. It is easily configurable and makes it easy for everyone to collaborate together hassle free.
Top comments (0)