Azure / azure-sdk-for-rust

This repository is for the active development of the Azure SDK for Rust. For consumers of the SDK we recommend visiting Docs.rs and looking up the docs for any of libraries in the SDK.
MIT License
707 stars 245 forks source link

Enforce .editorconfig rules in CI #1768

Open heaths opened 2 months ago

heaths commented 2 months ago

We should find or write a way to enforce .editorconfig rules in CIs to keep code consistent. rustfmt works great for .rs files but that seems to be its limit.

_Originally posted by @heaths in https://github.com/Azure/azure-sdk-for-rust/pull/1724#discussion_r1727966285_

heaths commented 2 months ago

https://github.com/editorconfig-checker/editorconfig-checker might be an option. They also have a GitHub Actions action: https://github.com/marketplace/actions/editorconfig-checker-action

hallipr commented 1 month ago

We can add that. Currently, .editorconfig officially supports a very limited set of 7 rules:

If combined with VSCode's format-on-save, we'll want to ensure that our CI linting tool and VSCode are using the same rules. I believe the formatting rules in VSCode are a superset of the editorconfig rules, so VSCode formatting should pass editorconfig checks.

heaths commented 1 month ago

We also should center on VSCode. Lots of editors support .editorconfig out of the box like helix or VS, or with a plugin like vim or VSCode. Per our conversation over Teams, if prettier support reading from .editorconfig, we could use that and have it "inherit" those settings instead of duplicating them.

Ideally it can also enforce headers, which are a requirement for source files if supported (which they are for Rust).