freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] Updates to Docwriter: Logging, testing, linting


From: Nikolaus Waxweiler
Subject: Re: [ft-devel] Updates to Docwriter: Logging, testing, linting
Date: Sat, 14 Jul 2018 14:30:17 +0200

> I would really like to use a formatting tool like yapf, but the only problem 
> is that it doesn't have a configuration/option for the foo( bar ) format 
> (space in brackets). I checked options from 
> https://github.com/google/yapf/blob/master/README.rst#knobs. Am I missing 
> something?

There likely isn’t one because `foo( bar )` is discouraged in Python-land: 
https://www.python.org/dev/peps/pep-0008/#pet-peeves. If it’s okay with Werner, 
I strongly suggest going with idiomatic Python style instead of carrying over 
the C style. The formatter Black will do everything you need for that.

> This is fixed. Module descriptions are in docstrings now.

As I commented on GitHub, I recommend using 
https://pypi.org/project/docformatter/ for formatting docstrings.

In short: automate all the drudgery you can automate and you will increase 
maintainability.


Speaking of automation, did I mention pre-commit yet? https://pre-commit.com/, 
`pip install pre-commit`.

It automates running Git hooks on your project on every commit. You can e.g. 
automatically run black on the source, remove spurious line-end whitespace, 
check YAML files and much more.

You insert a file like 
https://github.com/fonttools/ufoLib2/blob/master/.pre-commit-config.yaml in 
your top-level and run `pre-commit install`. After that, every commit is run 
through the gauntlet before being allowed to pass. Follow the repo URLs to see 
available hooks to run. I personally like pyupgrade. You could also run it via 
tox on Travis: https://github.com/fonttools/ufoLib2/blob/master/tox.ini


reply via email to

[Prev in Thread] Current Thread [Next in Thread]