Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

simplify flake8 usage #323

Closed
leorochael opened this issue Mar 30, 2016 · 6 comments
Closed

simplify flake8 usage #323

leorochael opened this issue Mar 30, 2016 · 6 comments

Comments

@leorochael
Copy link

leorochael commented Mar 30, 2016

Flake8 is currently invoked twice by travis, once for __init__.py files, and another for regular python files, with slightly different flake8 configuration files (travis_run_flake8__init__.cfg and travis_run_flake8.cfg, respectively).
#292 notwithstanding, by installing flake8-putty as well, it should be possible to use a single flake8 invocation with a single configuration file, like this:

[flake8]
# E123,E133,E226,E241,E242 are ignored by default by pep8 and flake8
ignore = E123,E133,E226,E241,E242
max-line-length = 79
putty-auto-ignore = True
putty-ignore =
# F401 is legal in odoo __init__.py files
    *__init__.py : +F401
# F811 is legal in odoo 8 when we implement 2 interfaces for a method
    /@api.v(7|8)/ : +F811

The above configuration has the advantage of only ignoring redefinitions that are actually decorated by api.v7 or api.v8, while catching other redefinitions.

@moylop260
Copy link
Contributor

👍

Are you planning create a new pr?

@leorochael
Copy link
Author

Not right now, I'm a bit unfamiliar with the codebase and my workload is a bit high for the moment. I might get around to it later if no one else beats me to it.

In any case, I'm documenting it here for people who wants to run flake8 with their own IDEs and can't convince them to run flake8 twice.

@osvalr
Copy link

osvalr commented Mar 31, 2016

👍

@dreispt
Copy link
Member

dreispt commented Apr 20, 2016

I don't think we should invest in flake8: AFAIK pylint can also do everything that flake8 is currently doing, so we could use a single style checking tool.

@leorochael
Copy link
Author

@dreispt I agree in general, but as long as we're using flake8, if we can go from two flake8 configurations to one configuration with a very simple change like above (and one extra pip package), we'll make it easier for people to integrate flake8 into their favorite IDEs.

For example, with the text I posted above inside a .flake8 file in the root of your project, and the linter-flake8 package of the atom editor with the linter-flake8 package, you get beautiful real-time highlights of the errors.

The same works for pylint and the linter-pylint package in atom, of course, but to do that, someone will have to enable and test in pylint all errors that flake8 currently catches for us.

IMHO we shouldn't block a small improvement just because we intend to replace it with something better latter.

@nhomar
Copy link
Member

nhomar commented Oct 30, 2017

This topic will be solved in the refactor started in #500 closing for the refactor. This is being considerated

@nhomar nhomar closed this as completed Oct 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants