-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AIRFLOW-3695] Replace Flake8 by Pylint #4511
Conversation
Hey @BasPH, I like your proposal to use pylint to have cleaner code because like you said pylint has more strict rules by default but I actually would be even more strict in that sense that we would add it instead of replacing it and use both flake8 + pylint because flake8 has some checks that even pylint does not have I believe. At work we use both for our custom airflow plugins and it is working great. |
Whoops Pylint made the sensible choice to drop Python2 support with Pylint2 which I'm installing and now the tests are failing. Will check tonight. |
@feluelle I thought Flake8 checks only PEP8 + logic, and PyLint does that too + code smells + more. Will investigate more how they overlap tonight. |
@BasPH Thank you. Maybe I am wrong and we only need pylint. That would be great to know :) |
I think we should send out an email with a title [VOTE] to get three binding votes to close the loop for this AIP. But I am +1 on having this. |
Just adding here that it would be good to check Prospector too. It seems to "replace" both pylint and flake8 and also add some other features. Actually it is more an integration testing tool than a replacement, but still worth looking. =) |
I haven't been involved as an airflow developer, but saw this on the mailing list and thought it would be helpful to comment given my experience with code formatters on half-a-dozen python projects: I've generally had negative experiences with pylint, and I'm not aware of projects having much success with it, relative to flake8 or increasingly black (which is a larger change, and doesn't operate on diffs). Are there any large python projects using pylint? |
Closed issue in favour of #5238. We will apply both Flake8 and Pylint in the near future. |
Yep. Good idea to keep both.. Both have slightly different scope and can be configured to work in parallel. |
Make sure you have checked all steps below.
Jira
Description
Following the dev mailing list about AIP-6, I replaced Flake8 by Pylint. I choose Pylint because it's a widely used tool, very configurable and is already used here and there in Airflow itself.
On top of the default Pylint configuration (see .pylintrc), I set some sensible defaults:
Pylint is much stricter than Flake8 and I'm sure it will lead to some discussion about the configuration in the beginning. However I'm convinced in the long run it will lead to much more consistent code. This PR adds and applies Pylint only on changed lines compared to master with the help of diff-cover. I see it as an intermediate solution, until the entire Airflow codebase is Pylint-compliant and we can simply run Pylint on complete changed files.
Tests
Commits
Documentation
Code Quality
Pylint