Re: [BuildStream] [Development topic] Use black to format code



Hi Chandan

I for one am definitely in favour of introducing Black to the
Buildstream source, and can live with an initial 'cleanup' commit.
However, how do you propose the use of Black going forward? Do you
expect it to become a manual part of the contributors workflow, or part
of some pre-commit/merge automation? I've also seen projects using Black
for scheduled blanket format commits, I can't say I'm too keen on that
though.

Cheers,

Tom

On 05/11/2019 13:34, Chandan Singh wrote:
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
_______________________________________________
buildstream-list mailing list
buildstream-list gnome org
https://mail.gnome.org/mailman/listinfo/buildstream-list


-- 
https://www.codethink.co.uk/privacy.html


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]