I generally dislike hard limits, but keeping lines shorter often helps. Shorter than 100 characters seems fine to me.
Il 31/12/2014 01:31, Fabian Neundorf ha scritto:
Hi all,
after a short discussion about the line length in the pywikibot-core repo I made a little analysis (or more like 'gathered' the data).
Currently the maximum allowed line length is 256 characters. Flake8 counts multi-bytes characters as one character (and afaik doesn't count the newline). The question is how easy it is to lower that to a value between 80 and 100 (when I submit code I try to have at most 80 characters sometimes it's 81).
Maybe to 200 is short term feasible with only a 16 exceeding those. With a maximum of 150 characters at least 47 lines need to be edited.
I used 'tox -e flake8' with the maximum line length set to 80 and then only used E501 entries. Some lines were garbled on the output like “./pywikibot/1: E501 line too long (82 > 80 characters)”. I tried to repair those lines if there was at least some kind of file name and line number (e.g. “ase.py:365”) but I deleted the rest. So those statistics only show the lowest number but I don't expect to much missing data.
The data is gathered from ad6920135ef015855724ac660fa0dcfb1459cfda. And is available sorted line number first (so they could be fixed in reversed order) or sorted with line length first (so super long lines can be fixed primarily). There is a gist which contains both lists and a list of the quantity of all line lengths [1] and a Google Spreadsheet containing just the quantity numbers [2] to determine easily how many would need to be solved when enforcing a specific limit.
Fabian
Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l