From f2a015971dc0037847d471fb1aeec9116f9dad0e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 29 Mar 2026 11:29:14 +0000 Subject: [PATCH] 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> --- backend/app/core/config.py | 4 +++- backend/app/main.py | 8 ++------ backend/app/services/dmarc_parser.py | 4 +--- backend/app/services/imap_client.py | 4 +--- backend/app/utils/stats_summarizer.py | 4 +--- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/backend/app/core/config.py b/backend/app/core/config.py index 97c0003..fdc01fc 100644 --- a/backend/app/core/config.py +++ b/backend/app/core/config.py @@ -74,7 +74,9 @@ class Settings(BaseSettings): return v @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("["): return [i.strip() for i in v.split(",")] if isinstance(v, (list, str)): diff --git a/backend/app/main.py b/backend/app/main.py index dba8d6c..0bb6eed 100644 --- a/backend/app/main.py +++ b/backend/app/main.py @@ -53,14 +53,10 @@ async def scheduled_imap_polling(): # If new domains were found, log them if results["new_domains"]: - logger.info( - "New domains found: %s", ", ".join(results["new_domains"]) - ) + logger.info("New domains found: %s", ", ".join(results["new_domains"])) else: - logger.error( - "IMAP polling failed: %s", results.get("error", "Unknown error") - ) + logger.error("IMAP polling failed: %s", results.get("error", "Unknown error")) except Exception as e: # pylint: disable=broad-exception-caught logger.error("Error in IMAP polling task: %s", str(e)) diff --git a/backend/app/services/dmarc_parser.py b/backend/app/services/dmarc_parser.py index 2adaf61..d892582 100644 --- a/backend/app/services/dmarc_parser.py +++ b/backend/app/services/dmarc_parser.py @@ -237,9 +237,7 @@ class DMARCParser: # Log parse results for debugging total_count = report["summary"]["total_count"] logger.info("Parsed DMARC report for domain: %s", report.get("domain")) - logger.info( - "Found %s record entries with %s total messages", len(records), total_count - ) + logger.info("Found %s record entries with %s total messages", len(records), total_count) logger.info( "Messages passed: %s, failed: %s", report["summary"]["passed_count"], diff --git a/backend/app/services/imap_client.py b/backend/app/services/imap_client.py index 73780ed..fd73b3b 100644 --- a/backend/app/services/imap_client.py +++ b/backend/app/services/imap_client.py @@ -392,8 +392,6 @@ class IMAPClient: reports_found += 1 logger.info("Successfully processed DMARC report: %s", filename) except Exception as e: # pylint: disable=broad-exception-caught - logger.error( - "Error processing attachment %s: %s", filename, str(e) - ) + logger.error("Error processing attachment %s: %s", filename, str(e)) return reports_found diff --git a/backend/app/utils/stats_summarizer.py b/backend/app/utils/stats_summarizer.py index 098f6f5..07ebada 100644 --- a/backend/app/utils/stats_summarizer.py +++ b/backend/app/utils/stats_summarizer.py @@ -130,9 +130,7 @@ class StatsSummarizer: safe_domain = domain_id.replace(".", "_").replace("/", "_") return os.path.join(self.cache_dir, f"domain_{safe_domain}.json") - def calculate_summary_statistics( - self, _db, domain_id: Optional[str] = None - ) -> Dict[str, Any]: + def calculate_summary_statistics(self, _db, domain_id: Optional[str] = None) -> Dict[str, Any]: """ Calculate summary statistics from the database