colcon / colcon-cargo

An extension for colcon-core to support Rust projects built with Cargo
http://colcon.readthedocs.io
Apache License 2.0
30 stars 20 forks source link

Add script / instructions for running the code formatter locally #13

Open bergercookie opened 3 years ago

bergercookie commented 3 years ago

Currently each developer has to setup flake8 on their own and look into the test_flake8.py for what rules should be ignored and what files to run it on.

Unrelated to this but, @dirk-thomas what's your opinion about switching to black or leave it up to each extension to decide the formatter/linter of choice?

I've used black consistently, it has excellent editors support and I haven't seen any notable bug when using it. It can be used both as a linter or as a formatter, and we can also lose the test_flake8.py file as well.

dirk-thomas commented 3 years ago

Since each package already decides it's own tests this package can use whatever it prefers. I don't see a strong reason to change what is used for other packages though.

bergercookie commented 3 years ago

@lelongg , what do you think of using black in this repo?

There might be a first PR that changes multiple lines to adhere to black, (e.g., changing single quotes to double, which is also reported as a warning by flake) but after that, maintaining it and checking for errors both for developers and in CI will be simplified significantly IMO.

I can make a first pass + PR to show you how that would look..