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

🔧 update default_settings.toml and main.py #384

Merged
merged 3 commits into from
Jul 9, 2024
Merged

🔧 update default_settings.toml and main.py #384

merged 3 commits into from
Jul 9, 2024

Conversation

mraniki
Copy link
Owner

@mraniki mraniki commented Jul 9, 2024

Summary by Sourcery

Enhanced the handler initialization to support a library or parser_library and updated the default action_identifier to include 'DEFAULT'.

  • Enhancements:
    • Added support for specifying a library or parser_library in handler initialization.
    • Updated action_identifier default value to include 'DEFAULT'.

Copy link

sourcery-ai bot commented Jul 9, 2024

Reviewer's Guide by Sourcery

This pull request updates the default_settings.toml and main.py files to enhance the configuration and logging capabilities. Additionally, it refines the handler.py to include a new library configuration and cleans up commented-out debug statements.

File-Level Changes

Files Changes
findmyorder/main.py
findmyorder/default_settings.toml
Enhanced configuration handling and logging in main.py and updated action_identifier in default_settings.toml.

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @mraniki - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 3 issues found
  • 🟡 Security: 1 issue found
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

Comment on lines +28 to +29
self.library = kwargs.get("library", None) or kwargs.get(
"parser_library", "standard"
Copy link

Choose a reason for hiding this comment

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

suggestion: Consider simplifying the library assignment logic.

The current logic for assigning self.library can be simplified to self.library = kwargs.get("library") or kwargs.get("parser_library", "standard"). This makes the code more readable.

Suggested change
self.library = kwargs.get("library", None) or kwargs.get(
"parser_library", "standard"
self.library = kwargs.get("library") or kwargs.get("parser_library", "standard")

Comment on lines -67 to -71
# logger.debug("Order identifier: {}", order_identifier)
# logger.debug("Action identifiers: {}", self.action_identifiers)
if order_identifier in self.action_identifier:

# logger.debug("Order identifier found in {}", order_identifier)
Copy link

Choose a reason for hiding this comment

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

suggestion: Consider removing commented-out debug statements.

The commented-out debug statements can be removed to keep the code clean and maintainable. If these logs are no longer needed, it's better to remove them entirely.

@@ -45,13 +45,15 @@ def __init__(
"""

self.enabled = settings.findmyorder_enabled
self.settings = settings.findmyorder
logger.debug("Settings: {}", self.settings)
Copy link

Choose a reason for hiding this comment

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

🚨 issue (security): Consider the security implications of logging settings.

Logging the entire settings object might expose sensitive information. Ensure that no sensitive data is included in the settings or consider logging only non-sensitive parts.

if not self.enabled:
logger.info("Module is disabled. No Client will be created.")
return
self.client_classes = self.get_all_client_classes()
self.clients = []
# Create a client for each client in settings.findmyorder
for name, client_config in settings.findmyorder.items():
for name, client_config in self.settings.items():
Copy link

Choose a reason for hiding this comment

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

issue (bug_risk): Check for potential NoneType in settings.

Ensure that self.settings is not None before iterating over its items. This can prevent potential runtime errors.

Copy link

codecov bot commented Jul 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (17bc83b) to head (69b4d94).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #384   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         6           
  Lines          138       141    +3     
=========================================
+ Hits           138       141    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mraniki mraniki merged commit 83d88a6 into main Jul 9, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant