-
Notifications
You must be signed in to change notification settings - Fork 2
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
Adding pre commit hooks #26
base: main
Are you sure you want to change the base?
Conversation
Warning Rate Limit Exceeded@matiasz8 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 32 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. WalkthroughThe recent updates encompass various aspects of the codebase. Import statement reorganization across multiple Python files ensures a consistent order and adherence to stylistic conventions. Additionally, there's an update to the Python version, the addition of pre-commit hooks for code quality checks, and the inclusion of Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to path filters (1)
Pipfile.lock
is excluded by:!**/*.lock
Files selected for processing (18)
- .github/PULL_REQUEST_TEMPLATE.md (1 hunks)
- .pre-commit-config.yaml (1 hunks)
- .python-version (1 hunks)
- Pipfile (1 hunks)
- jobs/etl/init.py (1 hunks)
- jobs/etl/extract.py (1 hunks)
- jobs/etl/load_s3.py (1 hunks)
- jobs/io/init.py (1 hunks)
- jobs/io/helpers.py (1 hunks)
- jobs/io/reader.py (1 hunks)
- jobs/io/writer.py (1 hunks)
- jobs/pyspark_hello_world.py (1 hunks)
- libs/aws/s3.py (1 hunks)
- libs/common/init.py (1 hunks)
- libs/config/init.py (1 hunks)
- libs/config/secrets.py (1 hunks)
- libs/db/docdb_mongo.py (1 hunks)
- libs/db/mongo.py (1 hunks)
Files skipped from review due to trivial changes (9)
- .github/PULL_REQUEST_TEMPLATE.md
- .python-version
- jobs/etl/load_s3.py
- jobs/io/init.py
- jobs/io/reader.py
- jobs/io/writer.py
- libs/config/init.py
- libs/config/secrets.py
- libs/db/docdb_mongo.py
Additional comments: 11
libs/common/__init__.py (1)
- 1-2: The reordering of imports in
libs/common/__init__.py
is correct and follows the alphabetical order which is a common convention in Python.jobs/etl/__init__.py (1)
- 1-4: The reordering of imports in
jobs/etl/__init__.py
is correct and follows the alphabetical order which is a common convention in Python.Pipfile (1)
- 20-20: Adding
pre-commit
as a dependency in thePipfile
is appropriate as it is necessary for the new pre-commit hooks to function.jobs/etl/extract.py (1)
- 7-7: The re-import of
libs.config.Config
injobs/etl/extract.py
is correct and does not change the functionality, assuming the import was not removed elsewhere in the file.jobs/pyspark_hello_world.py (1)
- 8-8: The reordering of imports and the addition of
extract
,load_to_postgresql_db
, andload_to_s3
injobs/pyspark_hello_world.py
is correct. However, ensure that the commented-out importload_to_document_db
is intentional and that its functionality is not required elsewhere in the code.Verification successful
The commented-out import
load_to_document_db
injobs/pyspark_hello_world.py
is not actively used within that file. The function is defined in thejobs/etl
module, but there is no indication from the current context that it is required injobs/pyspark_hello_world.py
. The review comment is consistent with the codebase.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify if the commented-out import `load_to_document_db` is used elsewhere in the code. rg --type py 'load_to_document_db'Length of output: 374
Script:
#!/bin/bash # Check for any active usage of load_to_document_db in jobs/pyspark_hello_world.py rg 'load_to_document_db' jobs/pyspark_hello_world.pyLength of output: 161
.pre-commit-config.yaml (1)
- 4-27: The updates to
.pre-commit-config.yaml
are correct and include a comprehensive set of hooks for code quality checks. Ensure that the hooks are compatible with the project's existing codebase and that they do not introduce any breaking changes.libs/aws/s3.py (3)
- 1-1: The addition of the
Union
import inlibs/aws/s3.py
is correct and follows best practices for type hinting.- 2-2: The addition of the
boto3
import inlibs/aws/s3.py
is correct, assuming it is used within the file.- 4-4: The removal of the unused import
get_config
fromlibs/aws/s3.py
is a good practice to keep the code clean and maintainable.libs/db/mongo.py (1)
- 2-2: The addition of the
PyMongoClient
import inlibs/db/mongo.py
is correct and necessary for theMongoClient
class to function properly.jobs/io/helpers.py (1)
- 3-3: The addition of the
load_tls_ca_bundle
import injobs/io/helpers.py
is correct, assuming it is used within the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔥
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 6
Configuration used: CodeRabbit UI
Files selected for processing (3)
- jobs/io/helpers.py (9 hunks)
- libs/config/env.py (2 hunks)
- libs/db/mongo.py (5 hunks)
Additional comments: 9
libs/db/mongo.py (2)
- 1-1: The addition of
Optional
from thetyping
module is a good practice for indicating that certain parameters can beNone
. This enhances type safety and clarity in the codebase.- 92-92: Changing the return type of the
find_one
method toOptional[Dict[str, Any]]
is a positive change that accurately reflects the possibility of the method returningNone
if no document matches the query. This is a good practice for type safety.jobs/io/helpers.py (7)
- 1-1: The addition of
Optional
to the import from thetyping
module is appropriate for the changes made to function signatures in this file, indicating that certain parameters can beNone
. This is a good practice for enhancing type safety and clarity.- 12-13: The use of
Optional[str]
for theuser
andpassword
parameters in theget_url_for_engine
function is a good practice that accurately reflects the optional nature of these parameters. This change improves the function's type safety and clarity.- 48-49: Similarly, applying
Optional[str]
to theuser
andpassword
parameters in the_build_mongodb_connection_string
function is a positive change that enhances the function's type safety by clearly indicating that these parameters can beNone
.- 65-65: The addition of
Optional[str]
to theauthchars
parameter in the_encode_mongodb_auth_special_chars
function is a good practice. It accurately reflects that the parameter can beNone
, improving the function's type safety and clarity.- 112-112: Using
Optional[str]
for theengine
parameter in theget_driver_for_engine
function is a positive change that enhances type safety by clearly indicating that the parameter can beNone
.- 132-132: The application of
Optional[str]
to theengine
parameter in theget_format_for_engine
function is another good practice that improves type safety and clarity by indicating the optional nature of the parameter.- 154-167: The reordering of parameters in the
get_connection_options
function, specifically moving thessl
parameter to the end, and the use ofOptional
for several parameters, is a thoughtful change that enhances the function's readability and type safety. This modification makes the function's interface more intuitive and aligns with Python's convention of placing optional parameters at the end.
libs/config/env.py
Outdated
@@ -10,7 +10,7 @@ class EnvironmentVariable: | |||
args = {} | |||
cache = {} | |||
|
|||
def __init__(self, args: dict = None) -> None: | |||
def __init__(self, args: dict = None) -> None: # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding # type: ignore
to the __init__
method bypasses type checking for this method. Ensure that this is intentional and that the potential risks of skipping type checks are understood and mitigated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (3)
- .github/workflows/lint.yml (2 hunks)
- libs/config/env.py (3 hunks)
- libs/db/mongo.py (5 hunks)
Files skipped from review as they are similar to previous changes (2)
- libs/config/env.py
- libs/db/mongo.py
What's this PR do?
This pull request enhances the existing pre-commit hooks and introduces additional hooks for improved code quality.
Upon running these hooks, I have addressed issues in other files, ensuring a more robust and reliable codebase.
@ulises-jeremias @edamico @Tsemenzato
Summary by CodeRabbit
Refactor
Dependencies
pre-commit
to the project dependencies for automated code review checks.Chores