Questions tagged [pycodestyle]

pycodestyle is a simple python style analyzer used for checking python code against some style conventions in PEP 8.

51 questions
24
votes
1 answer

what is best practice to control "too many local variable in a function" without suppress and manipulate pylint settings?

I'm working to make sure python code files must be 10/10 score with regular pylint and pycodestyle. but, I'm getting hard change from "too many local variable" in the functions. The functions could to split due to timing issue of whole suite. please…
Jatinder Singh Brar
  • 421
  • 1
  • 5
  • 11
21
votes
1 answer

How to fix issues with E402?

We are trying to fix issues with PEP8 E402. Mostly our code is broken on: import os os.environ['LIB_CAN_THROW_ERROR_ON_IMPORT'] = 2 import lib os.environ['LIB_CAN_THROW_ERROR_ON_IMPORT'] = 0 # back - if sys.version_info[0] > 2: import…
aleskva
  • 1,644
  • 2
  • 21
  • 40
16
votes
3 answers

How to make pylint, flake8 or pycodestyle to automatically correct errors?

I have properly installed all of the aforementioned modules on a VM I use on Ubuntu 18.04. When running either of them on a specific script or folder, they do correctly identify style errors and output them in the console. E.g.: (venv) .../src$…
Jan
  • 264
  • 1
  • 5
  • 14
10
votes
1 answer

python: pycodestyle (ex pep8) vs pylint strictness

I have a python project that I want to check against PEP8 conformance. My setyp.cfg is the following: [pycodestyle] count = True ignore = E266, W504 max-line-length = 80 statistics = True exclude = .venv,./build% After some cleaning up, my…
pkaramol
  • 16,451
  • 43
  • 149
  • 324
7
votes
1 answer

JupyterLab 3.0.14 How to disable code style highlights (pycodestyle)

I just installed WPy64-3940 that comes with JupyterLab 3.0.14 . To my surprise, now my code comes decorated with things called "pycodestyle". As you can see below, the code is underlined in orange and a popup can appear. I do not like that at all,…
user10085055
7
votes
1 answer

python flake8 ignore E501 and max-line-length

what is the purpose of using both [flake8] ignore = E501 max-line-length = 120 i have seen lot of codebases following this format in setup.cfg file but my question is if you ignore E501 then you code accepts any number of characters per line in a…
Kiran
  • 81
  • 1
  • 1
  • 4
7
votes
3 answers

The best way to store constants in Django

I have a Django application and use GitHub for CI. Now I run into the problem that I have a merge conflict with constants import every time I merge. Another developers are importing constants vary often, so do I. Directories tree looks like…
v18o
  • 1,237
  • 2
  • 15
  • 25
3
votes
3 answers

"ModuleNotFoundError: No module named 'pycodestyle'"

I have installed pycodestyle on my mac in the same path using pip install pycodestyle but when I check for its version I get- "pycodestyle" --version Traceback (most recent call last): File "/Users/shashwatkhilar/tools/bin/pycodestyle", line…
3
votes
0 answers

How do I disable a "pycodestyle" warning inside a python code?

I need to disable a warning of a pycodestyle check within a python code snippet. How to do that?
Alex
  • 41,580
  • 88
  • 260
  • 469
3
votes
1 answer

How to add Python pep8 exclusion on Spyder?

How to add Python pep8 exclusions on Spyder mac os? Added this: [pycodestyle] ignore = W191 to this file: /Users/myname/opt/anaconda3/bin/.pycodestyle <-- created this file and it just gets ignored. And please, how do I add multiple exclusions?
Mattman85208
  • 1,858
  • 2
  • 29
  • 51
3
votes
2 answers

pep8 - statistics for whole project

I am working on a Python project and I am using the PyPI pep8 checker. Is there a simple way to get a pep8 rating for my project? Like a percentage (eg. 10 lines doesn't match pep8, out of 100 lines) or any number to rate it? As far as I know pep8 /…
Zweistein
  • 293
  • 1
  • 4
  • 11
3
votes
1 answer

Spyder ignores .pycodestyle

I am using Spyder v.3.2.8 and I'm trying to modify the Real-time code style analysis. For example, I'd like to set the max-line-length to 99. I exactly followed what was suggested here, i.e. I created a file .pycodestyle in the directory resulting…
E. Sommer
  • 710
  • 1
  • 7
  • 28
3
votes
0 answers

pycodestyle "continuation line unaligned" not obviously correct - bug, configurable or user error?

This is a minimal example based on my code: def fn(self): Foo() \ .with_bar( Bar() .with_baz('Baz') ) I find this quite readable, but pycodestyle complains: stdin:5:17: E131 continuation line…
l0b0
  • 55,365
  • 30
  • 138
  • 223
2
votes
1 answer

Emacs - Python LSP setup.cfg not honored

I'm using vanilla Emacs and I installed lsp-mode as follows: (use-package lsp-mode :init (setq lsp-keymap-prefix "C-c l") :commands (lsp lsp-deferred) :config (defun lsp-go-install-save-hooks () (add-hook 'before-save-hook…
se7entyse7en
  • 4,310
  • 7
  • 33
  • 50
2
votes
1 answer

Spyder 4.1.5 disable selected pycodestyle warnings

After updating Spyder to 4.1.5 my script is covered with a whole bunch of taste-specific alerts like: Code analysis: E261 at least two spaces before inline comment (pycodestyle E261) or Code analysis: E266 too many leading '#' for block comment…
1
2 3 4