Automatic Python Linters and Formatters for Arcanist


Linting code is important when working in a team, code written by others starts becoming familiar and easier to understand. Your team will possibly be divided on a big set of important aspects(tabs or spaces duh), but it is important to decide something that works for everyone and move towards one implementation quickly.

We use Phabricator for our code review process, and it supports linting at time of adding reviews. Arcanist has a lot of built in linters based on pep8, flake8 etc. These linters tell the problems that exist with the code and if you have a big project, you are likely to see 100s of problems first time your run these.

I was convinced that we needed something which is non-obtrusive and does linting automatically instead of telling us what the problems are. Such linters can’t solve everything suggested by the PEP8 suggestion, but I find that they do a reasonably good job of ensuring code is clean and readable in a fast-paced environment.

I have written a small wrapper around the following auto code-formatters for Arcanist to bring some consistency in our development process. You can find the repository here: Arcanist Python Lint Autoformat.

Included formatters

AutoPEP8
YAPF
Black

You can read more about each of these and quirks of using these here.



Source link

WP Twitter Auto Publish Powered By : XYZScripts.com
Exit mobile version