Created
March 30, 2018 06:55
-
-
Save tossmilestone/23139d870841a3d5cba2aea28da1a895 to your computer and use it in GitHub Desktop.
Flake8 integrated with PyCharm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| How to manually setup flake8 as PyCharm external tool | |
| File / Settings / Tools / External Tools / Add | |
| Name: Flake8 | |
| Program: $PyInterpreterDirectory$/python | |
| Parameters: -m flake8 --max-complexity 10 --ignore E501 $FilePath$ | |
| Working directory: $ProjectFileDir$ | |
| Output Filters / Add | |
| Name: Filter 1 | |
| Regular expression to match output: | |
| $FILE_PATH$\:$LINE$\:$COLUMN$\:.* | |
| Output Filters / Add | |
| Name: Filter 2 | |
| Regular expression to match output: | |
| $FILE_PATH$\:$LINE$\:.* | |
| To check source with flake8: | |
| Tools / External Tools / Flake8 | |
| Can be used with single files as well as with directories, recursively. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey there, I managed to configure WSP using LSP4IJ in PyCharm and good old pipx. I assume you have pipx.
Here's how
1 Install python-lsp-server
2 Verify Installation.
Expected output:
3 Find pylsp Executable Path
Note the path:
C:\Users\Day\.local\bin\pylsp.exe4 Create LSP server
pylsp-flake8C:\Users\Day\.local\bin\pylsp.exe{ "pylsp": { "plugins": { "flake8": { "enabled": true, "maxLineLength": 70, "select": ["WPS", "E"], "ignore": ["WPS111", "WPS602"] }, "pycodestyle": { "enabled": false }, "pyflakes": { "enabled": false } } } }or
{ "pylsp": { "plugins": { "flake8": { "enabled": true, "config": "C:\\...whatever...\\.flake8" }, "pycodestyle": { "enabled": false }, "pyflakes": { "enabled": false }, "mccabe": { "enabled": false }, "pyls_isort": { "enabled": false }, "pylsp_mypy": { "enabled": false }, "rope_autoimport": { "enabled": false }, "rope_completion": { "enabled": false } } } }In Mappings - Language - Languages add the Python language.
Click OK
5 Restart PyCharm
Restart PyCharm completely for the LSP server to initialize.
6 Test Inline Errors
Create a test file with intentional WPS errors: