Il 15/01/2015 17:26, Fabian Neundorf ha scritto:
Is there a styleguide or was there a discussion already, because I think it would be good to have at least some set of rules. Some are already handled by flake8 so jenkins will prevent that some style guides are broken but there is for example:
There have been many discussions, and some results, as Amir pointed out, but automatic programs like flake8 aren't able to catch every 'violation' of styling conventions.
- PEP-8 compatible names. Should all new attributes/method/variables
be PEP-8 compatible? There is a task on phabricator to be compliant with the 2.0 release (so with 3.0 the other code can be removed) https://phabricator.wikimedia.org/T85328
Of course they should, but PEP-8 compliance is often used as a means to break backwards-compatibility with old non-PEP-8-compliant names.
- Another is whether we want to use %-notation or str.format. I
personally prefer the str.format because it doesn't require any magic but many submissions use %-notation and I previously didn't care about that. But should we only use one mode and which of those then? And when we allow both and others ask what they should use, should I recommend what we like or do we want to have one recommendation?
PEP 3101 https://www.python.org/dev/peps/pep-3101/ recommends str.format, but the % operator is still very common. Most importantly, the i18n functions use it.
- Last week (afaik) I noted on this list the line lengths (I probably
should update them now where Amir's patch was merged). Should we enforce a specific limit (like 100 chars?). I also saw that gerrit supported to show a line to indicate the 80 character width. Is it possible to enable that on our gerrit (to make it easier for us to see)?
My 2 cents: keeping lines shorter is fine, but there may be some cases in which enforcing a specific limit would make the code less readable.
If you have additional points which could be defined in a style guide please let me know.
Fabian
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l