[
https://issues.apache.org/jira/browse/AIRFLOW-3968?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16779087#comment-16779087
]
ASF GitHub Bot commented on AIRFLOW-3968:
-----------------------------------------
mik-laj commented on pull request #4790: [AIRFLOW-3968][2/3]Refactor base gcp
hook
URL: https://github.com/apache/airflow/pull/4790
Make sure you have checked _all_ steps below.
### Jira
- https://issues.apache.org/jira/browse/AIRFLOW-3968
### Description
The proposed PR introduces various changes related to GoogleCloudBaseHook:
- Move all decorators to top-level of module.
There were two ways to place decorations in the file:
1. as a static method on GoogleCloudBaseHook
2. as a static method on nested class _Decorators in class
GoogleCloudBaseHook.
In my opinion, the applied level of nesting is unjustified.
This is also indicated in Google's code style guide:
http://google.github.io/styleguide/pyguide.html#217-function-and-method-decorators
- Create property `scope` to separate complex logic from the
`get_credentials` method.
This allows us to test the code in isolation. Tests have been added.
- Simplify logic of `fallback_to_default_project_id`.
The logic of the method has been unnecessarily complicated. The helper
method used was used deleted. There have been added tests to check the code's
logic.
- Some code fragment did not follow the line width rule.
- Use `@decoractor` syntax.
The old syntax is not supported by
[autoapi](https://lists.apache.org/[email protected]:lte=5M:).
### 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](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
- [ ] In case of new functionality, my PR adds documentation that describes
how to use it.
- When adding new operators/hooks/sensors, the autoclass documentation
generation needs to be added.
- All the public functions and the classes in the PR contain docstrings
that explain what it does
### Code Quality
- [ ] Passes `flake8`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Refactor Base GPC Hook
> ----------------------
>
> Key: AIRFLOW-3968
> URL: https://issues.apache.org/jira/browse/AIRFLOW-3968
> Project: Apache Airflow
> Issue Type: Improvement
> Reporter: Kamil Bregula
> Priority: Major
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)