[Python-Dev] Code formatter bot
Ben Finney
ben+python at benfinney.id.au
Wed Jan 20 03:35:45 EST 2016
francismb <francismb at email.de> writes:
> what's your opinion about a code-formatter bot for cpython.
What is the proposal? The opinions will surely depend on:
* What formatting is to be applied automatically?
* If you propose to enforce rigid interpretations of the style-guide
PEPs as automatic rules, that will incur the wrath of those who have
made clear those PEPs are not to be used that way. There is a clear
opinion (from at least the BDFL) that the style guide PEPs are
guidelines to be applied with human judgement.
* If on the other hand you propose to enforce only those rules which
are strict enough to be applied automatically (e.g. “don't mix
spaces and TABs”, “encode source using UTF-8 only”) then that's best
done by editor plug-ins like EditorConfig[0].
* At which point in the workflow will the formatting be applied?
* If you propose to change the code *after* the programmer sees it in
their text editor, that is sure to be unpopular. The code committed
to VCS should exactly match what the programmer sees when they
choose to commit.
* If you propose to reject the code at time of committing, there are
VCS hooks that can do that; I don't know what different system you
propose.
* If you propose to present formatting violations as errors in the
programmer's text editor so they can be corrected before using the
VCS, then there are tools like EditorConfig[0] to do that.
[0]: EditorConfig <URL:http://editorconfig.org/>
--
\ “Pinky, are you pondering what I'm pondering?” “I think so, |
`\ Brain, but isn't a cucumber that small called a gherkin?” |
_o__) —_Pinky and The Brain_ |
Ben Finney
More information about the Python-Dev
mailing list