Hey all,

Matti pointed out to me that discussion of an autoformatter has come up
before, with the decision that an entire codebase rewrite would be
undesirable (ref:
https://mail.python.org/pipermail/scipy-dev/2020-January/023927.html). As a
result, tools/linter.py was added to only validate the changed lines. There
is better support for autoformatters that only work on changed lines now,
and I'd like to propose adding one.

I already have a pre-commit demo implemented here, with an example run:
https://github.com/numpy/numpy/pull/21449. It applies Black to changed
python file lines plus flake8 to validate them (changed lines only), and
clang-format with the pep7 config to any changed c/c++ lines. Pre-commit
has the easy interface to run on staged files (default) all files, specific
files, or files changed between --from-ref and --to-ref.

I don't necessarily know that this should be enforced on CI off the bat
(though in the future it could be), but at least having the tool available
and easily usable would help to incrementally improve codebase style, and
remove the need for formatting by hand.

Any thoughts?

- Trevor
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to