Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 module, again why they are using max-line-length?

like image 572
Kiran Avatar asked May 27 '26 23:05

Kiran


2 Answers

I believe this is because the default characters per line is 82, so they ignore that so it can exceed that number, but then set a larger limit (120 in your case)

like image 147
Rolv Apneseth Avatar answered May 30 '26 13:05

Rolv Apneseth


It would be enough to have only max-line-length. Default is 79.

In setup.cfg

[flake8]
max-line-length = 88
  • No lint error here when having lines longer than 79 (and <=88), i.e. setting the max-line-length overwrites ignore = E501
  • 88 is the default length of black formatter.
like image 45
Pascal Avatar answered May 30 '26 12:05

Pascal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!