Python development uses Pycharm.
Python Coding style warning
Variable in function should be lowercasepep8 indentation is not a multiple of four (appears when changing the Indent size from 4 half-width spaces to 2)Is annoying everywhere, so I will put the setting method in Pycharm to suppress this on the back of the leaflet.
 with File→Setting and uncheck PEP 8 coding naming convention viloation` with File→Setting and select PEP 8 coding style viloation` on the search screen in the right pane. to ʻIgnore errors and execute ʻApply`'ignoreErrorCodes':'E111, E501' in config.cson Looks goodAbout Indent
It is recommended to make one indent (Tab) with four Spaces
If you want to suppress this error, ignore E111 and E114
About function names and variable names
Function name, variable name: It is recommended to separate all lowercase letters with _ (set_stream_logger etc.)
Class name: Upper Camel Case recommended (eg GetImageLocation)
Other than Pycharm, Flake8 (PEP8 Wrap library) and [pep8-naming (flake8 plugin)](https://github.com/flintwork/ It seems that you should put pep8-naming) and set it to ignore N802 / N806 etc. (I have not tried it)
1 line length
Up to 79 characters per line is recommended
If you want to suppress this error, ignore E501
About Import Declaration
1 line 1 library Import recommended
If you want to suppress this error, ignore E401
Whitespace before and after the operator
Insert a space before and after operators such as =, ==, <,>, is, in, not in
If you want to suppress this error, ignore E221 and E222
There are two types of tools, pep8 and ʻautopep8`.
pep8pip install pep8 and check pep8 xxx.py --show-source * If you specify .py, the error code and the corresponding part will be spit out as shown below.pep8 xxx.py --ignore = E111, E114, E501 --show-source
E111 / 114 is ʻIndent Error, E501 is Line Too Long`xxx.py:4:1: E302 expected 2 blank lines, found 1
def foo():
^
misc_test.py:5:9: E225 missing whitespace around operator
    msgs=['Hello','World!!']
        ^
misc_test.py:5:18: E231 missing whitespace after ','
    msgs=['Hello','World!!']
                 ^
misc_test.py:9:10: W292 no newline at end of file
    foo()
         ^
pip install autopep8 and want it to be automatically corrected as ʻautopep8 -i xxx.py` * If you specify .py, the contents of File will be corrected without asking questions (so be careful when executing) is)Recommended Posts