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

🔨 Refactor IMAPSettings #10

Merged

Conversation

ARYAN-NIKNEZHAD
Copy link
Contributor

Description

This pull request refactors the IMAPSettings class to improve code organization and maintainability by implementing the following changes:

Changes Made

  1. Moved DEFAULTS Dictionary:

    • The DEFAULTS dictionary has been moved to a new constants.py file. This change enhances code organization by centralizing default settings.
  2. Introduced EXCLUDED_FROM_VALIDATION:

    • Added a new constant, EXCLUDED_FROM_VALIDATION, to the IMAPSettings class. This constant specifies which settings should be excluded from validation if they are None.
  3. Updated IMAPSettings Class:

    • The IMAPSettings class has been updated to use EXCLUDED_FROM_VALIDATION to determine whether a setting should trigger a validation error. This update makes the validation logic clearer and more maintainable.

Details

  • Constants File:

    • The new constants.py file contains the DEFAULTS dictionary and any other relevant constants, improving the organization of settings-related code.
  • Validation Logic:

    • The IMAPSettings class now checks against EXCLUDED_FROM_VALIDATION when determining if a None value for a setting should raise an IMAPConfigurationError.

Benefits

  • Improved Code Organization:

    • Centralizing constants in a dedicated file helps in managing and updating settings more effectively.
  • Enhanced Maintainability:

    • The updated validation logic is clearer and easier to adjust, thanks to the use of EXCLUDED_FROM_VALIDATION.

This refactoring improves the overall structure of the code, making it more robust and easier to maintain.

Files Changed

  • constants.py: Added to store the DEFAULTS dictionary and other constants.
  • settings.py (or the file containing IMAPSettings): Updated to include the new EXCLUDED_FROM_VALIDATION constant and adjusted validation logic.

Please review the changes and let me know if any further modifications are needed.

Closes #9

…ogic

- Moved DEFAULTS dictionary to a new constants file for better organization.
- Added EXCLUDED_FROM_VALIDATION constant to IMAPSettings class to specify which settings should not trigger validation errors if they are None.
- Updated IMAPSettings class to use EXCLUDED_FROM_VALIDATION for validation checks.

This refactoring improves code readability and maintainability by centralizing constants and clarifying validation logic.
@sepehr-akbarzadeh sepehr-akbarzadeh merged commit 47fe13c into sageteamorg:main Jul 26, 2024
0 of 3 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.

🔨 Refactor IMAPSettings Class: Introduce Constants File and Update Validation Logic
2 participants