Skip to content

Commit

Permalink
⚡ Update(validators) sort imports and ignore some unimportant errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MEHRSHAD-MIRSHEKARY committed Aug 27, 2024
1 parent c481756 commit 1990ca7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions django_logging/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ class DjangoLoggingConfig(AppConfig):

def ready(self) -> None:
from django_logging.settings import checks
from django_logging.utils.set_conf import set_config
from django_logging.utils.get_conf import get_config
from django_logging.utils.set_conf import set_config

conf = get_config()

# Set the logging configuration
set_config(*conf)
set_config(**conf)
9 changes: 4 additions & 5 deletions django_logging/validators/config_validators.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import os
import re
from datetime import datetime

from typing import List

from django.core.checks import Error

from django_logging.constants import LOG_FORMAT_SPECIFIERS, FORMAT_OPTIONS
from django_logging.constants import FORMAT_OPTIONS, LOG_FORMAT_SPECIFIERS
from django_logging.constants.config_types import (
FormatOption,
LogLevels,
LogEmailNotifierType,
LogLevels,
)


Expand All @@ -27,7 +26,7 @@ def validate_directory(path: str, config_name: str) -> List[Error]:
elif not os.path.exists(path):
try:
os.makedirs(os.path.dirname(path), exist_ok=True)
except Exception as e:
except Exception: # pylint: disable=broad-exception-caught
errors.append(
Error(
f"The path specified in {config_name} is not a valid path.",
Expand Down Expand Up @@ -222,7 +221,7 @@ def validate_email_notifier(notifier_config: LogEmailNotifierType) -> List[Error
errors.append(
Error(
f"Unknown type '{expected_type}' for {config_name}.",
hint=f"Check the expected types in LogEmailNotifierType.",
hint="Check the expected types in LogEmailNotifierType.",
id=f"django_logging.E018_{config_name}",
)
)
Expand Down
2 changes: 2 additions & 0 deletions django_logging/validators/email_settings_validator.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from typing import List

from django.conf import settings
from django.core.checks import Error

from django_logging.constants.required_email_settings import (
EMAIL_REQUIRED_SETTINGS,
NOTIFIER_EXTRA_REQUIRED_SETTING,
Expand Down

0 comments on commit 1990ca7

Please sign in to comment.