[
https://issues.apache.org/jira/browse/AIRFLOW-5373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16920553#comment-16920553
]
ASF GitHub Bot commented on AIRFLOW-5373:
-----------------------------------------
potiuk commented on pull request #5979: [AIRFLOW-5373] Super fast pre-commit
check for basic python2 compatib…
URL: https://github.com/apache/airflow/pull/5979
…ility
Make sure you have checked _all_ steps below.
### Jira
- [x] My PR addresses the following [Airflow
Jira](https://issues.apache.org/jira/browse/AIRFLOW/) issues and references
them in the PR title. For example, "\[AIRFLOW-XXX\] My Airflow PR"
- https://issues.apache.org/jira/browse/AIRFLOW-5373
### Description
- [x] Here are some details about my PR, including screenshots of any UI
changes:
### Tests
- [x] My PR adds the following unit tests __OR__ does not need testing for
this extremely good reason:
### Commits
- [x] 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](http://chris.beams.io/posts/git-commit/)":
1. Subject is separated from body by a blank line
1. Subject is limited to 50 characters (not including Jira issue reference)
1. Subject does not end with a period
1. Subject uses the imperative mood ("add", not "adding")
1. Body wraps at 72 characters
1. Body explains "what" and "why", not "how"
### Documentation
- [x] 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](https://github.com/apache/airflow/blob/master/UPDATING.md) so
we can assign it to a appropriate release
### Code Quality
- [x] Passes `flake8`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Super fast pre-commit check for basic python2 compatibility (for
> cherry-picking)
> --------------------------------------------------------------------------------
>
> Key: AIRFLOW-5373
> URL: https://issues.apache.org/jira/browse/AIRFLOW-5373
> Project: Apache Airflow
> Issue Type: Improvement
> Components: ci
> Affects Versions: 1.10.5
> Reporter: Jarek Potiuk
> Assignee: Jarek Potiuk
> Priority: Major
> Attachments: matches_python3.txt
>
>
> I thought about a super-fast way of protecting against bad python3
> cherry-picks in our v1-10-test branch. From the experience, it looks like we
> have two types of problems most often:
> # super()
> # python3 type annotations in definition of function parameters/return values
> # python3 type annotations in variables
> I tried to find some good "proper" solution to check automatically if the
> code is python2-compliant but surprisingly could not find anything fast and
> good (actually there are plenty of python3 compat checkers and
> auto-converters but I could not find good verification is some python3
> constructs are used in python2 code).
> However it came to me that we can likely do a simple grep that should be able
> to catch vast majority of those case with very limited (if at all) false
> positives. It turned out to be a good idea for 1 and 2 (which is vast
> majority of cases I think) :
> Such simple and straigthforward regexp does the work beautifully:
>
> {code:java}
> ".super\\(\\)|^\\s+def\\s*\\S*\\([^):]*:.*\\)|^\\sdef\\s*\\S*\\(.*\\):\\s*\\-\\>\\s*\\S*"
>
> {code}
> I managed to find two actual problems (but the code was in comments so no
> impact ! )- Python3 incompatibilitites in v1-10-test this way (!!!). In
> master we have 830 matching lines (attached) so I think it's rather good.
>
>
>
>
>
--
This message was sent by Atlassian Jira
(v8.3.2#803003)