Flake8: Difference between revisions
From charlesreid1
| (2 intermediate revisions by the same user not shown) | |||
| Line 7: | Line 7: | ||
</pre> | </pre> | ||
==Relaxing Line Length Standard== | ==Configuring== | ||
Also covered in the documentation: http://flake8.pycqa.org/en/3.3.0/user/configuration.html | |||
===Relaxing Line Length Standard=== | |||
To relax the max line length default, set it with the flake8 config file. | To relax the max line length default, set it with the flake8 config file. | ||
| Line 18: | Line 22: | ||
</pre> | </pre> | ||
==Ignoring certain errors and warnings== | ===Ignoring certain errors and warnings=== | ||
Suppose one of the warnings or errors is the bane of your existence and you never want to see it again. Easy enough, just add it to the ignore list in your flake config file at <code>~/.config/flake8</code>: | Suppose one of the warnings or errors is the bane of your existence and you never want to see it again. Easy enough, just add it to the ignore list in your flake config file at <code>~/.config/flake8</code>: | ||
| Line 25: | Line 29: | ||
[flake8] | [flake8] | ||
ignore = E203, E266, E501, W503 | ignore = E203, E266, E501, W503 | ||
</pre> | </pre> | ||
| Line 37: | Line 38: | ||
[[Black]] - the uncompromising Python formatter | [[Black]] - the uncompromising Python formatter | ||
[[Yapf]] - yet another python formatter (from google) | |||
[[PEP8]] - the pep about style | |||
[[Pep8ify]] - to automatically apply formatting changes to make code conform to PEP8 | |||
==Flags== | ==Flags== | ||
Latest revision as of 17:42, 7 August 2019
Installing
Install the flake8 command line utility to run Python code through flake8 and find where it does not meet the standards:
pip install flake8
Configuring
Also covered in the documentation: http://flake8.pycqa.org/en/3.3.0/user/configuration.html
Relaxing Line Length Standard
To relax the max line length default, set it with the flake8 config file.
Put the following into your ~/.config/flake8 file:
[flake8] max-line-length = 120
Ignoring certain errors and warnings
Suppose one of the warnings or errors is the bane of your existence and you never want to see it again. Easy enough, just add it to the ignore list in your flake config file at ~/.config/flake8:
[flake8] ignore = E203, E266, E501, W503
Vim Plugin
https://github.com/nvie/vim-flake8
Related
Black - the uncompromising Python formatter
Yapf - yet another python formatter (from google)
PEP8 - the pep about style
Pep8ify - to automatically apply formatting changes to make code conform to PEP8
Flags
| Python a powerful programming language
Scientific Python: Data analysis libraries: Scipy · Numpy · Pandas · Statsmodel Machine learning libraries: Sklearn Neural network libraries: Tensorflow · Keras Plotting/viz: Matplotlib · Seaborn · Jupyter Solving partial differential equations and bessel functions: Fipy · Bessel Functions
Web and Networking Python: Web programming: Flask · Webapps · Mechanize · Scrapy · Gunicorn Wifi: Wireless/Python · Scapy IPython and Jupyter: Jupyter
Drawing, Geometry, and Shapes: Shapely (for drawing shapes): Shapely Geography library: Geos
General Useful Python Utilities: Python Remote Objects: Pyro Logging (create multi-channel log messages): Logging Keyboard (control keyboard from Python): Keyboard
Black Hat Python: Network scanning: Python/Scanner
|