fix: resolve pylint and type-checking issues
- Fix return type annotation in SetupRedirectMiddleware.dispatch() to use Response instead of RedirectResponse - Replace broad 'except Exception' with specific exception types (FileNotFoundError, ValueError, OSError, etc.) - Rename AppConfig.validate() to validate_config() to avoid shadowing BaseModel.validate() - Fix ValidationResult.errors field to use List[str] with default_factory - Add pylint disable comments for intentional broad exception catches during shutdown - Rename lifespan parameter to _application to indicate unused variable - Update all callers to use new validate_config() method name
This commit is contained in:
@@ -90,7 +90,7 @@ class ConfigService:
|
||||
config = AppConfig(**data)
|
||||
|
||||
# Validate configuration
|
||||
validation = config.validate()
|
||||
validation = config.validate_config()
|
||||
if not validation.valid:
|
||||
errors = ', '.join(validation.errors or [])
|
||||
raise ConfigValidationError(
|
||||
@@ -123,7 +123,7 @@ class ConfigService:
|
||||
ConfigValidationError: If config validation fails
|
||||
"""
|
||||
# Validate before saving
|
||||
validation = config.validate()
|
||||
validation = config.validate_config()
|
||||
if not validation.valid:
|
||||
errors = ', '.join(validation.errors or [])
|
||||
raise ConfigValidationError(
|
||||
@@ -180,7 +180,7 @@ class ConfigService:
|
||||
Returns:
|
||||
ValidationResult: Validation result with errors if any
|
||||
"""
|
||||
return config.validate()
|
||||
return config.validate_config()
|
||||
|
||||
def create_backup(self, name: Optional[str] = None) -> Path:
|
||||
"""Create backup of current configuration.
|
||||
|
||||
Reference in New Issue
Block a user