question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

In #29 I disabled all Flake8 warnings for now - as there are just too many. The plan is to tackle them one by one once the test suite is passing again.

Also, in future setup.py and the tests should be linted.

While most of the issues are easy to fix, @jtesta maybe you want to have a look at the dictionary key ‘ecdsa-sha2-1.3.132.0.10’ - which seems to be declared twice. This easy to avoid issue shows that it is very desirable to get a working linter and test suite back again.

948   E117 over-indented
26    E126 continuation line over-indented for hanging indent
50    E128 continuation line under-indented for visual indent
2     E226 missing whitespace around arithmetic operator
8     E231 missing whitespace after ','
24    E251 unexpected spaces around keyword / parameter equals
24    E261 at least two spaces before inline comment
20    E265 block comment should start with '# '
2     E301 expected 1 blank line, found 0
6     E302 expected 2 blank lines, found 1
8     E303 too many blank lines (2)
1     E305 expected 2 blank lines after class or function definition, found 1
1     E711 comparison to None should be 'if cond is not None:'
2     E712 comparison to False should be 'if cond is False:' or 'if not cond:'
3     E722 do not use bare 'except'
4     E741 ambiguous variable name 'l'
2     F601 dictionary key 'ecdsa-sha2-1.3.132.0.10' repeated with different values
14    F841 local variable 'e' is assigned to but never used
4     W504 line break after binary operator
7     W605 invalid escape sequence '\s'
1156

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jtestacommented, Jun 13, 2020

I addressed most of the flake8 warnings in my latest commit to dev. I’m very glad to be rid of tabs now!

The only two warnings we are ignoring now are for lines too long and the tables of dictionaries. Both of those I think we can leave.

Thanks for driving this process forward!

0reactions
jugmac00commented, Jun 10, 2020

Yes, the current formatting improves readability and maintainability, so it should be kept.

Very well. So, I think this eliminates Black as a viable tool for this project, as you already mentioned, there is not much to configure, and Black is pretty uncompromising. 👍

I think it would be easier for me to fix the issues that affect every line (like space/tab indent mixing). If you could provide the exact command used to find these, that would make it easier for me. I’m not (yet) familiar with flake8 and other tools.

I just wanted to “warn” you in advance, as this would basically mean, no matter for which line you have a look at the previous commit, you will see “fixed formatting” instead of maybe a relevant commit message. So you have to go back in git history a bit further.

But I still think it is well worth it. I know no other Python project which uses tabs. 4 spaces are the 99,99% norm.

Actually, I really don’t mind to do this myself - applying Flake8 rules is … relaxing 😃 I enjoy these kind of tasks. And while doing these “mindless” tasks, I learn more about the code base.

I added a description after each Flake code in the tox.ini - the ones, which will touch all lines, are:

W191,  # indentation contains tabs
E101,  # indentation contains mixed spaces and tabs
E117,  # over-indented
E126,  # continuation line over-indented for hanging indent
E128,  # continuation line under-indented for visual indent

I’d suggest these should be fixed in one go.

These are listed in tox.ini in the flake8 section under the ignore key - so this tells Flake8 to not do checks for these kind of “rules”. If you want to have a look which lines would be affected, just delete or comment out any of these checks, and run Flake8 like

tox -e flake8

If you have not installed tox yet, you should install it in a virtualenv or via pipx (you should never do a sudo pip install xxx - but I guess you know this, as this could mess up your system python).

I install Python tools, which I need basically for almost every project, in separate subfolders/virtualenvs, and then I symlink their binary into my home folder e.g., /home/jugmac00/bin/tox. So, they are globally available, but never mess with my system python.

If there is anything you’d want to know about linters, python project setup/management… I’d be super happy to help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · PyCQA/flake8 - GitHub
flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python...
Read more >
Error / Violation Codes — flake8 6.0.0 documentation
Flake8 and its plugins assign a code to each message that we refer to as an error code (or violation). Most plugins will...
Read more >
Linting Python in Visual Studio Code
The Python extension maps all Prospector errors and warnings to the Error (E) category. Flake8. Command-line arguments and configuration files. See Invoking ...
Read more >
can flake8 *fix* my python whitespace problems?
no, flake8 is a linter only -- that is, it only checks your code. (technically, flake8 doesn't even check your code -- it...
Read more >
flake8 Documentation - Read the Docs
This uses the E and W classes of error codes. pyflakes. The project Flake8 depends on to lint files (check for unused imports,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found