Skip to content
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-5170] [AIRFLOW-5256] Consistent licences for python files and related pylint fixes #5786

Conversation

potiuk
Copy link
Member

@potiuk potiuk commented Aug 12, 2019

This is the first set of new static checks to add (for python files)

As described in another PR - I split it per file type. There will be about 7 or 8 such changes.

This one is by far the biggest because it is for python files:

  • It makes licence files consistent accross all python files (there were subtle differences, mistakes partially copied licenses etc). Now we have single LICENSE.txt file from which we automatically add licence to python file if it is missing. The same LICENSE.txt file will be used for other file types.
  • It adds coding pragma for all files if they are missing
  • It checks if there are no debug statements left in python code
  • It fixes pylint errors in all the files touched by either LICENSE.txt change or pragma - this is actually what causes so many changes (but only in files that were changed because one of the two other changes: pragma/license)

We also have a script that can refresh pylint_todo.txt (used in this case)

There are quite a number of pylint fixes but they were all planned anyway.

Jira

Description

  • Here are some details about my PR, including screenshots of any UI changes:

Tests

  • My PR adds the following unit tests OR does not need testing for this extremely good reason:

Commits

  • My commits all reference Jira issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it.
    • All the public functions and the classes in the PR contain docstrings that explain what it does
    • If you implement backwards incompatible changes, please leave a note in the Updating.md so we can assign it to a appropriate release

Code Quality

  • Passes flake8

@potiuk potiuk requested review from dimberman, BasPH and mik-laj August 12, 2019 14:24
@potiuk
Copy link
Member Author

potiuk commented Aug 12, 2019

@dimberman @BasPH @mik-laj -> next step after adding pre-commit checks. This check adds automatically enccoding pragma for all .py files and fixes all related pylint problems.

@BasPH -> I also added a script to refresh pylint_todo.txt automatically (and remove all files that have been fixed so far)

@potiuk potiuk force-pushed the add-encoding-pragma-hook-with-pylint-fixes branch 3 times, most recently from 2ad7517 to f8761b6 Compare August 13, 2019 11:28
@potiuk potiuk changed the title [AIRFLOW-5170] Fix encoding pragma and related pylint fixes (depends on AIRFLOW-5161] [AIRFLOW-5170] Fix encoding pragmas, consistent licences for python files and related pylint fixes Aug 15, 2019
@potiuk potiuk force-pushed the add-encoding-pragma-hook-with-pylint-fixes branch 2 times, most recently from 54ae759 to 2cd9734 Compare August 15, 2019 04:00
@potiuk potiuk requested review from ashb and Fokko August 15, 2019 04:15
@potiuk
Copy link
Member Author

potiuk commented Aug 15, 2019

@ashb @dimberman @Fokko -> this is the first additional set of checks (for python files) added after merging the pylint/mypy/flake checks in pre-commit. It will make our python code much more consistent (and fixes/disables a lot of pylint errors). We also have a script that can refresh pylint_todo.txt

@potiuk potiuk force-pushed the add-encoding-pragma-hook-with-pylint-fixes branch from 2cd9734 to e2b016c Compare August 16, 2019 01:38
@potiuk
Copy link
Member Author

potiuk commented Aug 16, 2019

All reported so far resolved.

@mik-laj mik-laj added the area:dev-env CI, pre-commit, pylint and other changes that do not change the behavior of the final code label Aug 16, 2019
Copy link
Member

@feluelle feluelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@potiuk Nice work as always. If you have time please look over my comments. :)

.pre-commit-config.yaml Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
CONTRIBUTING.md Outdated Show resolved Hide resolved
airflow/contrib/hooks/databricks_hook.py Outdated Show resolved Hide resolved
airflow/contrib/hooks/qubole_hook.py Outdated Show resolved Hide resolved
dev/airflow-jira Show resolved Hide resolved
tests/contrib/utils/gcp_authenticator.py Show resolved Hide resolved
tests/operators/test_docker_operator.py Show resolved Hide resolved
tests/utils/log/elasticmock/__init__.py Outdated Show resolved Hide resolved
@potiuk potiuk force-pushed the add-encoding-pragma-hook-with-pylint-fixes branch 6 times, most recently from 29bc9cc to c4a40c1 Compare August 18, 2019 23:53
@potiuk potiuk changed the title [AIRFLOW-5170] Fix encoding pragmas, consistent licences for python files and related pylint fixes [AIRFLOW-5170] Consistent licences for python files and related pylint fixes Aug 19, 2019
@potiuk potiuk force-pushed the add-encoding-pragma-hook-with-pylint-fixes branch from c4a40c1 to 55a3963 Compare August 19, 2019 13:17
@potiuk potiuk changed the title [AIRFLOW-5170] Consistent licences for python files and related pylint fixes [AIRFLOW-5170] [AIRFLOW-5256] Consistent licences for python files and related pylint fixes Aug 19, 2019
@potiuk potiuk force-pushed the add-encoding-pragma-hook-with-pylint-fixes branch from cd57c40 to 7059f9f Compare September 11, 2019 21:59
@potiuk
Copy link
Member Author

potiuk commented Sep 11, 2019

Anyone :)

airflow/kubernetes/volume_mount.py Show resolved Hide resolved
docs/exts/exampleinclude.py Outdated Show resolved Hide resolved
docs/exts/exampleinclude.py Outdated Show resolved Hide resolved
scripts/ci/_utils.sh Show resolved Hide resolved
scripts/ci/in_container/_in_container_utils.sh Outdated Show resolved Hide resolved
@potiuk potiuk force-pushed the add-encoding-pragma-hook-with-pylint-fixes branch from e299e12 to 6f01e2b Compare September 12, 2019 16:26
@potiuk
Copy link
Member Author

potiuk commented Sep 12, 2019

Should be all fixed now @feluelle

Copy link
Member

@feluelle feluelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed some..

After this is done and green you can merge it, imo :)

airflow/kubernetes/volume.py Show resolved Hide resolved
airflow/kubernetes/volume.py Outdated Show resolved Hide resolved
@potiuk potiuk force-pushed the add-encoding-pragma-hook-with-pylint-fixes branch from 6f01e2b to 7923879 Compare September 16, 2019 00:33
@potiuk
Copy link
Member Author

potiuk commented Sep 16, 2019

@feluelle -> I think it will be green soon:)

@feluelle
Copy link
Member

What happened @potiuk ? There are far less changes in the commit than before.

@potiuk
Copy link
Member Author

potiuk commented Sep 16, 2019

Ups. I will take a look . Luckily Git does not forget things too easily

@potiuk potiuk force-pushed the add-encoding-pragma-hook-with-pylint-fixes branch from 7923879 to db4526b Compare September 16, 2019 20:14
@potiuk
Copy link
Member Author

potiuk commented Sep 16, 2019

@feluelle - reflog to the rescue. All should be good now :). Waiting for Travis...

@potiuk
Copy link
Member Author

potiuk commented Sep 16, 2019

All green @feluelle !

Copy link
Member

@feluelle feluelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@potiuk I unresolved the conversations where I think you missed a commit.

@potiuk potiuk force-pushed the add-encoding-pragma-hook-with-pylint-fixes branch from db4526b to eee6687 Compare September 17, 2019 09:54
@potiuk
Copy link
Member Author

potiuk commented Sep 17, 2019

Right. I thought I squashed it together :(.

Copy link
Member

@feluelle feluelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We made it @potiuk ! 🎉

@feluelle feluelle merged commit 4780105 into apache:master Sep 17, 2019
@potiuk
Copy link
Member Author

potiuk commented Sep 17, 2019

🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉 🎉

potiuk added a commit that referenced this pull request Sep 17, 2019
potiuk added a commit that referenced this pull request Sep 18, 2019
@potiuk potiuk deleted the add-encoding-pragma-hook-with-pylint-fixes branch September 19, 2019 22:43
ashb pushed a commit that referenced this pull request Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dev-env CI, pre-commit, pylint and other changes that do not change the behavior of the final code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants