Ericsson / codechecker

CodeChecker is an analyzer tooling, defect database and viewer extension for the Clang Static Analyzer and Clang Tidy
https://codechecker.readthedocs.io
Apache License 2.0
2.25k stars 378 forks source link

format python code with black #2802

Open gyorb opened 4 years ago

gyorb commented 4 years ago

Manual code formatting to make the code pep8 compliant can take a lot of time. black could be introduced to format automatically the python source code, it can be configured easily and there is a support for a lot of editors to automatically format the source code while writing it.

If the whole code was formatted in one commit, with a newer git the formatting commit can be left out from the git blame see the description here.

Can be integrated into the travis-ci too to check if the source code was formatted right for a PR.

gamesh411 commented 4 years ago

I am all for automatic code formatting. In clang, I use clang-format manually and with various tools like arcanist, git-hooks. I find it a major convenience factor for me. I use a vim-plugin CoC which suggests the following auto-formatting solutions right now:

I am not for or against any of these in particular, but I know that autopep8 refuses to format certain cases, therefore it not a fully automatic solution. I haven't tried the other ones. The ignore-rev-file option seems really handy 😉