Re: [BuildStream] [Development topic] Use black to format code
- From: Chandan Singh <chandan chandansingh net>
- To: buildstream-list gnome org
- Subject: Re: [BuildStream] [Development topic] Use black to format code
- Date: Tue, 5 Nov 2019 13:34:18 +0000
Apologies for the incorrect link in my previous email. This is the correct link:
https://gitlab.com/BuildStream/buildstream/compare/master...chandan%2Fblack
On Tue, Nov 5, 2019 at 1:28 PM Chandan Singh <chandan chandansingh net> wrote:
Hi all,
I wanted to propose using Black (https://github.com/psf/black) to format our
source code.
In case you are not already aware of Black, it describes itself as the
"uncompromising Python code formatter". It's inspired by things like `gofmt`
that is quite popular in the Go community. Very much by design, Black does not
offer a lot of configurability. There are only a couple of command-line options
that really affect the formatting of the code.
If we adopt this, we can safely drop `pycodestyle`. Similarly, we should also be
able to turn off all formatting related `pylint` warnings as they would be taken
care of by Black.
The biggest difference between linters like `pycodestyle` & `pylint`, and Black
is that rather than telling you what's wrong, Black will fix it for you. That
allows humans to focus more on the logic and the meaning of the code, rather
than fussing about how it looks..
It also has nice integrations for various IDEs and editors. (If you are a vim
user, the black repository itself can be used as Vim plugin for black.)
In case you are wondering what Black would do to our codebase, you can have a
look at the differences after running Black on my branch (with default options):
https://gitlab.com/BuildStream/buildstream/merge_requests/new/diffs?merge_request%5Bsource_branch%5D=chandan%2Fblack
Let me know what you think of Black.
Thanks!
Chandan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]