Plan: resolve linter contradictions
Agent-Logs-Url: https://github.com/christianlouis/dmarq/sessions/1e4a1f06-55b9-4040-853e-6aaf9ee574c8 Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -74,7 +74,9 @@ class Settings(BaseSettings):
|
|||||||
return v
|
return v
|
||||||
|
|
||||||
@validator("BACKEND_CORS_ORIGINS", pre=True)
|
@validator("BACKEND_CORS_ORIGINS", pre=True)
|
||||||
def assemble_cors_origins(cls, v: Union[str, List[str]]) -> List[str]: # pylint: disable=no-self-argument
|
def assemble_cors_origins(
|
||||||
|
cls, v: Union[str, List[str]]
|
||||||
|
) -> List[str]: # pylint: disable=no-self-argument
|
||||||
if isinstance(v, str) and not v.startswith("["):
|
if isinstance(v, str) and not v.startswith("["):
|
||||||
return [i.strip() for i in v.split(",")]
|
return [i.strip() for i in v.split(",")]
|
||||||
if isinstance(v, (list, str)):
|
if isinstance(v, (list, str)):
|
||||||
|
|||||||
+2
-6
@@ -53,14 +53,10 @@ async def scheduled_imap_polling():
|
|||||||
|
|
||||||
# If new domains were found, log them
|
# If new domains were found, log them
|
||||||
if results["new_domains"]:
|
if results["new_domains"]:
|
||||||
logger.info(
|
logger.info("New domains found: %s", ", ".join(results["new_domains"]))
|
||||||
"New domains found: %s", ", ".join(results["new_domains"])
|
|
||||||
)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.error(
|
logger.error("IMAP polling failed: %s", results.get("error", "Unknown error"))
|
||||||
"IMAP polling failed: %s", results.get("error", "Unknown error")
|
|
||||||
)
|
|
||||||
|
|
||||||
except Exception as e: # pylint: disable=broad-exception-caught
|
except Exception as e: # pylint: disable=broad-exception-caught
|
||||||
logger.error("Error in IMAP polling task: %s", str(e))
|
logger.error("Error in IMAP polling task: %s", str(e))
|
||||||
|
|||||||
@@ -237,9 +237,7 @@ class DMARCParser:
|
|||||||
# Log parse results for debugging
|
# Log parse results for debugging
|
||||||
total_count = report["summary"]["total_count"]
|
total_count = report["summary"]["total_count"]
|
||||||
logger.info("Parsed DMARC report for domain: %s", report.get("domain"))
|
logger.info("Parsed DMARC report for domain: %s", report.get("domain"))
|
||||||
logger.info(
|
logger.info("Found %s record entries with %s total messages", len(records), total_count)
|
||||||
"Found %s record entries with %s total messages", len(records), total_count
|
|
||||||
)
|
|
||||||
logger.info(
|
logger.info(
|
||||||
"Messages passed: %s, failed: %s",
|
"Messages passed: %s, failed: %s",
|
||||||
report["summary"]["passed_count"],
|
report["summary"]["passed_count"],
|
||||||
|
|||||||
@@ -392,8 +392,6 @@ class IMAPClient:
|
|||||||
reports_found += 1
|
reports_found += 1
|
||||||
logger.info("Successfully processed DMARC report: %s", filename)
|
logger.info("Successfully processed DMARC report: %s", filename)
|
||||||
except Exception as e: # pylint: disable=broad-exception-caught
|
except Exception as e: # pylint: disable=broad-exception-caught
|
||||||
logger.error(
|
logger.error("Error processing attachment %s: %s", filename, str(e))
|
||||||
"Error processing attachment %s: %s", filename, str(e)
|
|
||||||
)
|
|
||||||
|
|
||||||
return reports_found
|
return reports_found
|
||||||
|
|||||||
@@ -130,9 +130,7 @@ class StatsSummarizer:
|
|||||||
safe_domain = domain_id.replace(".", "_").replace("/", "_")
|
safe_domain = domain_id.replace(".", "_").replace("/", "_")
|
||||||
return os.path.join(self.cache_dir, f"domain_{safe_domain}.json")
|
return os.path.join(self.cache_dir, f"domain_{safe_domain}.json")
|
||||||
|
|
||||||
def calculate_summary_statistics(
|
def calculate_summary_statistics(self, _db, domain_id: Optional[str] = None) -> Dict[str, Any]:
|
||||||
self, _db, domain_id: Optional[str] = None
|
|
||||||
) -> Dict[str, Any]:
|
|
||||||
"""
|
"""
|
||||||
Calculate summary statistics from the database
|
Calculate summary statistics from the database
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user