[Replicant] [replicant-scripts][PATCH 3/4] Add script to produce a list of compatible devices from wikidata
Fil Lupin
fillupin at protonmail.com
Thu Mar 19 16:11:43 UTC 2020
Hi,
I tested devices.py with flake8, it does a static analysis and identified a few correction to improve it (https://lintlyci.github.io/Flake8Rules/):
- line 20: os.environ['PYWIKIBOT_NO_USER_CONFIG']='1'
flake8 detects E402 (https://www.flake8rules.com/rules/E402.html).
PEP8 recommands "Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants." (https://www.python.org/dev/peps/pep-0008/#imports).
To fulfill this rule, we could call python script device.py in two ways:
PYWIKIBOT_NO_USER_CONFIG=1 python devices.py
or
export PYWIKIBOT_NO_USER_CONFIG=1
python devices.py
The pro is to fulfill PEP8 rules, the con is to externalise the definition of the env variable.
- line 27 an line 40: flake8 detects that it lakes one breakline (https://www.flake8rules.com/rules/E302.html)
- line 44, 46, 59 : line too long, we could cut line by adding \ at the end of each cut end of line (https://www.flake8rules.com/rules/E501.html)
- line 68 : it lakes one breakline after the class definition (https://www.flake8rules.com/rules/E305.html)
- Fil Lupin.
More information about the Replicant
mailing list