Skip to content

Universal SEO skill for Claude Code. 26 sub-skills + 19 sub-agents covering technical SEO, E-E-A-T, schema, GEO/AEO, agent readiness (Lighthouse Agentic Browsing, WebMCP, llms.txt), backlinks, local SEO, e-commerce, international SEO, Google APIs, and PDF/Excel reporting. 9 optional extensions for live SEO data.

chore(lint): clean ruff findings

Agrici.Daniel892182818071
diff --git a/extensions/banana/scripts/setup_mcp.py b/extensions/banana/scripts/setup_mcp.py
index 4a27388..e214233 100755
--- a/extensions/banana/scripts/setup_mcp.py
+++ b/extensions/banana/scripts/setup_mcp.py
@@ -14,8 +14,8 @@ Usage:
"""
import json
-import sys
import os
+import sys
from pathlib import Path
SETTINGS_PATH = Path.home() / ".claude" / "settings.json"
@@ -93,9 +93,9 @@ def setup_mcp(api_key: str) -> None:
save_settings(settings)
print(f"\nMCP server '{MCP_NAME}' configured successfully!")
print(f" Package: {MCP_PACKAGE}")
- print(f" Model: MCP package default")
- print(f"\nRestart Claude Code for changes to take effect.")
- print(f"Generated images will be saved to: ~/Documents/nanobanana_generated/")
+ print(" Model: MCP package default")
+ print("\nRestart Claude Code for changes to take effect.")
+ print("Generated images will be saved to: ~/Documents/nanobanana_generated/")
def main() -> None:
@@ -135,7 +135,7 @@ def main() -> None:
if not api_key:
print("Claude Banana - MCP Setup")
print("=" * 40)
- print(f"\nGet your free API key at: https://aistudio.google.com/apikey")
+ print("\nGet your free API key at: https://aistudio.google.com/apikey")
print()
try:
api_key = input("Enter your Google AI API key: ")
diff --git a/scripts/analyze_visual.py b/scripts/analyze_visual.py
index 6b2a6f4..5476076 100755
--- a/scripts/analyze_visual.py
+++ b/scripts/analyze_visual.py
@@ -13,7 +13,8 @@ import sys
from urllib.parse import ParseResult, urlparse
try:
- from playwright.sync_api import sync_playwright, TimeoutError as PlaywrightTimeout
+ from playwright.sync_api import TimeoutError as PlaywrightTimeout
+ from playwright.sync_api import sync_playwright
except ImportError:
print("Error: playwright required. Install with: pip install playwright && playwright install chromium")
sys.exit(1)
diff --git a/scripts/backlinks_auth.py b/scripts/backlinks_auth.py
index 5e1fd54..82df06e 100644
--- a/scripts/backlinks_auth.py
+++ b/scripts/backlinks_auth.py
@@ -26,7 +26,7 @@ _SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__))
if _SCRIPTS_DIR not in sys.path:
sys.path.insert(0, _SCRIPTS_DIR)
try:
- from url_safety import validate_url
+ import url_safety # noqa: F401
except ImportError as _import_exc:
# Hard fail: a private-IP/loopback fallback that omits SSRF checks is
# worse than no validation at all. The previous fallback shipped in
diff --git a/scripts/capture_screenshot.py b/scripts/capture_screenshot.py
index ee768d5..3bed547 100755
--- a/scripts/capture_screenshot.py
+++ b/scripts/capture_screenshot.py
@@ -22,9 +22,11 @@ from urllib.parse import ParseResult, urlparse
try:
from playwright.sync_api import (
- sync_playwright,
TimeoutError as PlaywrightTimeout,
)
+ from playwright.sync_api import (
+ sync_playwright,
+ )
except ImportError:
print(
"Error: playwright required. Install with: "
@@ -41,7 +43,6 @@ from url_safety import ( # noqa: E402 (sys.path massage above is intentional)
validate_url_strict,
)
-
VIEWPORTS = {
"desktop": {"width": 1920, "height": 1080},
"laptop": {"width": 1366, "height": 768},
diff --git a/scripts/commoncrawl_graph.py b/scripts/commoncrawl_graph.py
index 5a9e73b..460129c 100644
--- a/scripts/commoncrawl_graph.py
+++ b/scripts/commoncrawl_graph.py
@@ -17,7 +17,6 @@ Usage:
"""
import argparse
-import csv
import gzip
import io
import json
@@ -35,7 +34,7 @@ except ImportError:
_SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, _SCRIPTS_DIR)
try:
- from backlinks_auth import get_cache_dir, load_config
+ from backlinks_auth import get_cache_dir
from google_auth import validate_url
except ImportError:
print("Error: backlinks_auth.py and google_auth.py required in scripts/", file=sys.stderr)
@@ -421,7 +420,7 @@ def main():
print(json.dumps(result, indent=2))
else:
data = result["data"]
- print(f"Common Crawl Web Graph Info")
+ print("Common Crawl Web Graph Info")
print(f" Latest release: {data.get('latest_release', 'unknown')}")
print(f" Known releases: {', '.join(data.get('known_releases', []))}")
print(f" Cache dir: {data.get('cache_dir', 'N/A')}")
diff --git a/scripts/content_humanize.py b/scripts/content_humanize.py
index 2e62b18..0a67b59 100644
--- a/scripts/content_humanize.py
+++ b/scripts/content_humanize.py
@@ -30,7 +30,6 @@ import re
import sys
from pathlib import Path
-
# Replacements run in order. Each entry is (pattern, replacement, label).
# Patterns are compiled with re.IGNORECASE and \b word boundaries where
# appropriate. The replacement preserves the original case of the first
diff --git a/scripts/content_quality.py b/scripts/content_quality.py
index 2369998..5efabbb 100644
--- a/scripts/content_quality.py
+++ b/scripts/content_quality.py
@@ -54,7 +54,6 @@ from collections import Counter
from pathlib import Path
from typing import Iterable
-
# Padding / filler phrases that QRG §4.6 flags as "little-to-no value".
# Each phrase scores 1 hit; threshold tuned at ~3 hits per 1000 tokens.
_FILLER_PHRASES: tuple[str, ...] = (
diff --git a/scripts/content_verify.py b/scripts/content_verify.py
index 61718f8..c55693f 100644
--- a/scripts/content_verify.py
+++ b/scripts/content_verify.py
@@ -54,7 +54,6 @@ import re
import sys
from pathlib import Path
-
# Claim patterns. Each is (regex, label). Order matters — first match
# wins per substring so a "47% of users" doesn't double-count as both
# statistic and quantity. Trailing-word groups are restricted to
diff --git a/scripts/dataforseo_costs.py b/scripts/dataforseo_costs.py
index 51559ae..84033fa 100644
--- a/scripts/dataforseo_costs.py
+++ b/scripts/dataforseo_costs.py
@@ -26,7 +26,6 @@ Security fixes: config path corrected to ~/.config/claude-seo/
import argparse
import json
-import os
import sys
from datetime import datetime, timedelta
from pathlib import Path
diff --git a/scripts/dataforseo_merchant.py b/scripts/dataforseo_merchant.py
index 5ccb33d..2783add 100755
--- a/scripts/dataforseo_merchant.py
+++ b/scripts/dataforseo_merchant.py
@@ -23,7 +23,6 @@ import os
import sys
import time
from typing import Any, Optional
-from urllib.parse import urlparse
# Add scripts directory to path for sibling imports
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
diff --git a/scripts/dataforseo_normalize.py b/scripts/dataforseo_normalize.py
index d6fb60f..7c5b485 100755
--- a/scripts/dataforseo_normalize.py
+++ b/scripts/dataforseo_normalize.py
@@ -20,7 +20,6 @@ import math
import sys
from typing import Any, Optional
-
# ---------------------------------------------------------------------------
# Generic helpers
# ---------------------------------------------------------------------------
diff --git a/scripts/domain_history.py b/scripts/domain_history.py
index 77fc79d..f271294 100644
--- a/scripts/domain_history.py
+++ b/scripts/domain_history.py
@@ -54,7 +54,6 @@ from __future__ import annotations
import argparse
import json
-import os
import re
import shutil
import socket
@@ -63,7 +62,6 @@ import sys
from datetime import datetime, timezone
from typing import Optional
-
_DATE_LABELS = {
"created": (
"creation date", "created on", "registered on", "registered",
diff --git a/scripts/drift_baseline.py b/scripts/drift_baseline.py
index fcea777..cd5dd26 100644
--- a/scripts/drift_baseline.py
+++ b/scripts/drift_baseline.py
@@ -22,7 +22,7 @@ import subprocess
import sys
import tempfile
from datetime import datetime, timezone
-from urllib.parse import parse_qs, urlparse, urlunparse, urlencode
+from urllib.parse import parse_qs, urlencode, urlparse, urlunparse
# ---------------------------------------------------------------------------
# Path setup — resolve scripts/ directory relative to this file
diff --git a/scripts/drift_compare.py b/scripts/drift_compare.py
index cdd8377..43b5e3b 100644
--- a/scripts/drift_compare.py
+++ b/scripts/drift_compare.py
@@ -25,9 +25,7 @@ from difflib import SequenceMatcher
SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, SCRIPTS_DIR)
-from google_auth import validate_url # noqa: E402
from drift_baseline import ( # noqa: E402
- DB_PATH,
fetch_cwv_data,
fetch_page_data,
hash_content,
@@ -35,7 +33,7 @@ from drift_baseline import ( # noqa: E402
normalize_url,
url_hash,
)
-
+from google_auth import validate_url # noqa: E402
# ---------------------------------------------------------------------------
# Baseline loading
diff --git a/scripts/drift_report.py b/scripts/drift_report.py
index a6a1353..2b168cc 100644
--- a/scripts/drift_report.py
+++ b/scripts/drift_report.py
@@ -18,7 +18,6 @@ import os
import sys
from datetime import datetime, timezone
-
# ---------------------------------------------------------------------------
# Claude-SEO color palette
# ---------------------------------------------------------------------------
diff --git a/scripts/fetch_page.py b/scripts/fetch_page.py
index b57fab7..fb8826f 100755
--- a/scripts/fetch_page.py
+++ b/scripts/fetch_page.py
@@ -32,7 +32,6 @@ if _SCRIPTS_DIR not in sys.path:
sys.path.insert(0, _SCRIPTS_DIR)
from url_safety import URLSafetyError, safe_requests_session, validate_url_strict # noqa: E402
-
DEFAULT_USER_AGENT = (
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 "
"(KHTML, like Gecko) Chrome/150.0.7871.114 Safari/537.36 ClaudeSEO/2.0"
diff --git a/scripts/ga4_report.py b/scripts/ga4_report.py
index 9de2d93..0c36887 100644
--- a/scripts/ga4_report.py
+++ b/scripts/ga4_report.py
@@ -15,7 +15,6 @@ import argparse
import json
import sys
from datetime import datetime, timedelta
-from typing import Optional
try:
from google.analytics.data_v1beta import BetaAnalyticsDataClient
@@ -447,7 +446,7 @@ def main():
print(json.dumps(result, indent=2, default=str))
else:
if args.report == "top-pages":
- print(f"=== Top Organic Landing Pages ===")
+ print("=== Top Organic Landing Pages ===")
print(f"Property: {prop} | Period: {result.get('date_range', {}).get('start')} to {result.get('date_range', {}).get('end')}")
print(f"Total organic sessions: {result.get('total_organic_sessions', 0):,}")
print()
@@ -456,7 +455,7 @@ def main():
print(f" Sessions: {page['sessions']:,} | Users: {page['users']:,} | Bounce: {page['bounce_rate']}%")
else:
totals = result.get("totals", {})
- print(f"=== GA4 Organic Traffic Report ===")
+ print("=== GA4 Organic Traffic Report ===")
print(f"Property: {prop}")
dr = result.get("date_range", {})
print(f"Period: {dr.get('start')} to {dr.get('end')}")
diff --git a/scripts/gbp_deprecation_lint.py b/scripts/gbp_deprecation_lint.py
index c3d0df1..5ea8710 100755
--- a/scripts/gbp_deprecation_lint.py
+++ b/scripts/gbp_deprecation_lint.py
@@ -37,7 +37,6 @@ if _SCRIPTS_DIR not in sys.path:
sys.path.insert(0, _SCRIPTS_DIR)
from url_safety import URLSafetyError, safe_requests_get # noqa: E402
-
# Patterns for retired GBP chat. The "Message" / "Chat" CTAs alone are
# common on commercial sites — we only flag when they appear NEAR a
# Google-business-related signal in the same DOM neighbourhood.
diff --git a/scripts/google_auth.py b/scripts/google_auth.py
index c7c88f4..48db68d 100644
--- a/scripts/google_auth.py
+++ b/scripts/google_auth.py
@@ -657,13 +657,10 @@ def detect_tier() -> dict:
has_api_key = bool(config.get("api_key"))
has_authenticated = False
has_ga4 = False
- auth_method = None
-
# Check OAuth token
token_data = _load_oauth_token()
if token_data and token_data.get("access_token"):
has_authenticated = True
- auth_method = "oauth_token"
# Check service account
if not has_authenticated:
@@ -676,7 +673,6 @@ def detect_tier() -> dict:
sa_data = json.load(f)
if "client_email" in sa_data and "private_key" in sa_data:
has_authenticated = True
- auth_method = "service_account"
except (json.JSONDecodeError, IOError):
pass
@@ -901,7 +897,7 @@ def main():
else:
print(f"Credential Tier: {tier_info['tier']} -- {tier_info['description']}")
if tier_info["missing"]:
- print(f"Run --setup for configuration instructions.")
+ print("Run --setup for configuration instructions.")
if __name__ == "__main__":
diff --git a/scripts/google_report.py b/scripts/google_report.py
index d08ed91..113114c 100644
--- a/scripts/google_report.py
+++ b/scripts/google_report.py
@@ -20,13 +20,12 @@ import sys
from datetime import datetime
from html import escape
from pathlib import Path
-from typing import Optional
try:
import matplotlib
matplotlib.use("Agg")
- import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
+ import matplotlib.pyplot as plt
import numpy as np
_CHART_IMPORT_ERROR = None
except (ImportError, OSError, RuntimeError) as exc:
@@ -280,8 +279,6 @@ def chart_cwv_timeline(data: dict, output_dir: Path) -> str:
axes = [axes]
x_labels = [p.get("last", "")[-5:] for p in periods] # MM-DD format
- x = range(len(x_labels))
-
for ax, metric_name in zip(axes, available):
m = metrics[metric_name]
p75s = m.get("p75_values", [])
@@ -1262,9 +1259,9 @@ def _build_executive_summary(domain, timestamp, data, report_type):
display_cards = cards[:5]
lines.append(f' <div class="{col_class}">')
for _, val, lbl, clr in display_cards:
- lines.append(f' <div class="col">')
+ lines.append(' <div class="col">')
lines.append(_metric_card(val, lbl, clr))
- lines.append(f' </div>')
+ lines.append(' </div>')
lines.append(' </div>')
lines.append('')
@@ -1535,9 +1532,9 @@ def _build_cwv_section(psi_data, crux_data, chart_paths, history_data=None, sect
if seo_failed:
lines.append(f' <h3>SEO Audit Issues ({len(seo_failed)})</h3>')
for a in seo_failed:
- lines.append(f' <div class="action-item critical">')
+ lines.append(' <div class="action-item critical">')
lines.append(f' <h4>{a.get("title", "")}</h4>')
- lines.append(f' </div>')
+ lines.append(' </div>')
else:
lines.append(f' <div class="success-box"><strong>SEO:</strong> '
f'All {len(seo_audits)} Lighthouse SEO checks passed.</div>')
@@ -1672,12 +1669,12 @@ def _build_gsc_section(gsc_data, chart_paths, section_num=3, fig_start=1):
beyond = len([r for r in rows if r.get("position", 99) > 10])
lines.append(f' <h3>{section_num}.4 Query Position Analysis</h3>')
lines.append(' <div class="two-col">')
- lines.append(f' <div class="col">')
+ lines.append(' <div class="col">')
lines.append(_metric_card(str(top3), "Queries in Top 3", BRAND["success"]))
- lines.append(f' </div>')
- lines.append(f' <div class="col">')
+ lines.append(' </div>')
+ lines.append(' <div class="col">')
lines.append(_metric_card(str(top10), "Queries in Top 10", BRAND["warning"]))
- lines.append(f' </div>')
+ lines.append(' </div>')
lines.append(' </div>')
if beyond:
lines.append(f' <p>{beyond} queries rank beyond position 10 '
@@ -1739,25 +1736,24 @@ def _build_indexation_section(inspect_data, chart_paths, section_num=4, fig_star
if idx_path:
fig_n = next_fig()
lines.append(f' <h3>{section_num}.1 Index Coverage Overview</h3>')
- lines.append(f' <div class="chart-container">')
+ lines.append(' <div class="chart-container">')
lines.append(f' <img src="file://{idx_path}" style="width: 70%;" alt="Index status donut chart">')
lines.append(f' <div class="chart-caption">Figure {fig_n}: URL indexation status distribution from Google URL Inspection API.</div>')
- lines.append(f' </div>')
+ lines.append(' </div>')
# Summary cards
lines.append(f' <p>Total URLs inspected: <strong>{total}</strong></p>')
lines.append(' <div class="two-col">')
- lines.append(f' <div class="col">')
+ lines.append(' <div class="col">')
lines.append(_metric_card(summary.get("pass", 0), "Indexed", BRAND["success"]))
- lines.append(f' </div>')
- lines.append(f' <div class="col">')
+ lines.append(' </div>')
+ lines.append(' <div class="col">')
lines.append(_metric_card(summary.get("fail", 0), "Not Indexed", BRAND["danger"]))
- lines.append(f' </div>')
+ lines.append(' </div>')
lines.append(' </div>')
lines.append('')
indexed = summary.get("pass", 0)
- not_indexed = summary.get("fail", 0)
if total > 0:
rate = round((indexed / total) * 100, 1)
lines.append(f' <p><strong>Index Rate:</strong> {rate}% of inspected URLs are indexed by Google.</p>')
@@ -1865,15 +1861,15 @@ def _build_recommendations(data, section_num=5):
)
if critical_items:
- lines.append(f' <h3><span class="priority-tag priority-critical">CRITICAL</span> '
- f'Fix Immediately</h3>')
+ lines.append(' <h3><span class="priority-tag priority-critical">CRITICAL</span> '
+ 'Fix Immediately</h3>')
for title, effort, desc in critical_items:
item_num += 1
- lines.append(f' <div class="action-item critical">')
+ lines.append(' <div class="action-item critical">')
lines.append(f' <h4>{item_num}. {title} '
f'<span class="effort">Effort: {effort}</span></h4>')
lines.append(f' <p>{desc}</p>')
- lines.append(f' </div>')
+ lines.append(' </div>')
lines.append('')
# High priority items
@@ -1906,15 +1902,15 @@ def _build_recommendations(data, section_num=5):
)
if high_items:
- lines.append(f' <h3><span class="priority-tag priority-high">HIGH</span> '
- f'Fix Within 1 Week</h3>')
+ lines.append(' <h3><span class="priority-tag priority-high">HIGH</span> '
+ 'Fix Within 1 Week</h3>')
for title, effort, desc in high_items:
item_num += 1
- lines.append(f' <div class="action-item high">')
+ lines.append(' <div class="action-item high">')
lines.append(f' <h4>{item_num}. {title} '
f'<span class="effort">Effort: {effort}</span></h4>')
lines.append(f' <p>{desc}</p>')
- lines.append(f' </div>')
+ lines.append(' </div>')
lines.append('')
# Medium priority items
@@ -1944,15 +1940,15 @@ def _build_recommendations(data, section_num=5):
)
if medium_items:
- lines.append(f' <h3><span class="priority-tag priority-medium">MEDIUM</span> '
- f'Fix Within 1 Month</h3>')
+ lines.append(' <h3><span class="priority-tag priority-medium">MEDIUM</span> '
+ 'Fix Within 1 Month</h3>')
for title, effort, desc in medium_items:
item_num += 1
- lines.append(f' <div class="action-item medium">')
+ lines.append(' <div class="action-item medium">')
lines.append(f' <h4>{item_num}. {title} '
f'<span class="effort">Effort: {effort}</span></h4>')
lines.append(f' <p>{desc}</p>')
- lines.append(f' </div>')
+ lines.append(' </div>')
lines.append('')
# If no recommendations were generated at all
@@ -2073,7 +2069,6 @@ def generate_report(report_type, data, domain, output_dir, output_format="pdf"):
charts_dir.mkdir(parents=True, exist_ok=True)
timestamp = datetime.now().strftime("%B %d, %Y")
- timestamp_short = datetime.now().strftime("%Y-%m-%d %H:%M")
result = {"report_type": report_type, "domain": domain, "files": [], "error": None}
# ── Generate Charts ──────────────────────────────────────────────────────
@@ -2468,7 +2463,7 @@ def generate_xlsx(data, domain, report_type, output_dir):
"""
try:
from openpyxl import Workbook
- from openpyxl.styles import Font, PatternFill, Alignment, Border, Side
+ from openpyxl.styles import Alignment, Border, Font, PatternFill, Side
from openpyxl.utils import get_column_letter
except ImportError:
print("Warning: openpyxl not installed. Skipping xlsx. Install: pip install openpyxl", file=sys.stderr)
@@ -2484,7 +2479,6 @@ def generate_xlsx(data, domain, report_type, output_dir):
amber_fill = PatternFill(start_color="FFF3CD", end_color="FFF3CD", fill_type="solid")
red_fill = PatternFill(start_color="F8D7DA", end_color="F8D7DA", fill_type="solid")
header_font = Font(name="Calibri", bold=True, color="FFFFFF", size=11)
- body_font = Font(name="Calibri", size=10)
thin_border = Border(
left=Side(style="thin", color="D6D3CC"),
right=Side(style="thin", color="D6D3CC"),
diff --git a/scripts/gsc_inspect.py b/scripts/gsc_inspect.py
index 988e3b0..7c624b1 100644
--- a/scripts/gsc_inspect.py
+++ b/scripts/gsc_inspect.py
@@ -15,7 +15,6 @@ import argparse
import json
import sys
import time
-from typing import Optional
try:
from googleapiclient.discovery import build
@@ -292,7 +291,7 @@ def main():
else:
if args.batch:
summary = result.get("summary", {})
- print(f"=== URL Inspection Batch Results ===")
+ print("=== URL Inspection Batch Results ===")
print(f"Property: {site_url}")
print(f"Total: {result.get('total', 0)} | Pass: {summary.get('pass', 0)} | Fail: {summary.get('fail', 0)} | Errors: {summary.get('error', 0)}")
print()
@@ -316,7 +315,7 @@ def main():
idx = result.get("index_status", {})
if idx:
- print(f"\nIndex Status:")
+ print("\nIndex Status:")
print(f" Coverage: {idx.get('coverage_state')}")
print(f" Robots.txt: {idx.get('robots_txt_state')}")
print(f" Indexing: {idx.get('indexing_state')}")
@@ -326,7 +325,7 @@ def main():
canon = result.get("canonical", {})
if canon:
- print(f"\nCanonical:")
+ print("\nCanonical:")
print(f" Google: {canon.get('google_canonical', 'N/A')}")
print(f" User: {canon.get('user_canonical', 'N/A')}")
match = canon.get("match")
diff --git a/scripts/indexing_notify.py b/scripts/indexing_notify.py
index f817455..7295346 100644
--- a/scripts/indexing_notify.py
+++ b/scripts/indexing_notify.py
@@ -21,11 +21,9 @@ import argparse
import json
import sys
import time
-from typing import Optional
try:
from googleapiclient.discovery import build
- from googleapiclient.http import BatchHttpRequest
except ImportError:
print(
"Error: google-api-python-client required. "
@@ -306,7 +304,7 @@ def main():
print(" No notifications found.")
elif args.batch:
summary = result.get("summary", {})
- print(f"=== Batch Indexing Notification ===")
+ print("=== Batch Indexing Notification ===")
print(f"Action: {args.action}")
print(f"Total: {result.get('total', 0)} | Success: {summary.get('success', 0)} | Errors: {summary.get('error', 0)}")
print(f"Estimated remaining daily quota: {result.get('estimated_remaining_quota', '?')}")
diff --git a/scripts/iptc_ai_label.py b/scripts/iptc_ai_label.py
index aaf29e6..e58f7ad 100644
--- a/scripts/iptc_ai_label.py
+++ b/scripts/iptc_ai_label.py
@@ -34,7 +34,6 @@ from __future__ import annotations
import argparse
import json
-import os
import shutil
import subprocess
import sys
diff --git a/scripts/keyword_planner.py b/scripts/keyword_planner.py
index 1394eba..848e77f 100644
--- a/scripts/keyword_planner.py
+++ b/scripts/keyword_planner.py
@@ -276,7 +276,7 @@ def main():
print(json.dumps(result, indent=2, default=str))
else:
if args.command == "ideas":
- print(f"=== Keyword Ideas ===")
+ print("=== Keyword Ideas ===")
for i, idea in enumerate(result.get("ideas", [])[:20], 1):
vol = idea.get("avg_monthly_searches", "?")
comp = idea.get("competition", "?")
@@ -285,7 +285,7 @@ def main():
bid_str = f"${bid_low:.2f}-${bid_high:.2f}" if bid_low and bid_high else "N/A"
print(f" {i:2d}. {idea['keyword']:40s} | Vol: {vol:>8} | Comp: {comp:8s} | CPC: {bid_str}")
elif args.command == "volume":
- print(f"=== Keyword Volumes ===")
+ print("=== Keyword Volumes ===")
for kw in result.get("keywords", []):
vol = kw.get("avg_monthly_searches", "?")
comp = kw.get("competition", "?")
diff --git a/scripts/lcp_subparts.py b/scripts/lcp_subparts.py
index 9f3659c..50ab221 100644
--- a/scripts/lcp_subparts.py
+++ b/scripts/lcp_subparts.py
@@ -28,16 +28,14 @@ import argparse
import json
import os
import sys
-
-import urllib.request
import urllib.error
+import urllib.request
_SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__))
if _SCRIPTS_DIR not in sys.path:
sys.path.insert(0, _SCRIPTS_DIR)
-from url_safety import URLSafetyError, validate_url_strict # noqa: E402
from google_auth import get_api_key, google_api_key_headers, redact_google_api_key # noqa: E402
-
+from url_safety import URLSafetyError, validate_url_strict # noqa: E402
CRUX_ENDPOINT = "https://chromeuxreport.googleapis.com/v1/records:queryRecord"
diff --git a/scripts/moz_api.py b/scripts/moz_api.py
index 49a016d..5480c50 100644
--- a/scripts/moz_api.py
+++ b/scripts/moz_api.py
@@ -19,7 +19,6 @@ import base64
import json
import sys
import time
-from typing import Optional
try:
import requests
@@ -29,10 +28,11 @@ except ImportError:
# Import credential helpers (same directory)
import os
+
_SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, _SCRIPTS_DIR)
try:
- from backlinks_auth import get_moz_api_key, load_config
+ from backlinks_auth import get_moz_api_key
from google_auth import validate_url
except ImportError:
print("Error: backlinks_auth.py and google_auth.py required in scripts/", file=sys.stderr)
diff --git a/scripts/nlp_analyze.py b/scripts/nlp_analyze.py
index 033a427..e8d5ca7 100644
--- a/scripts/nlp_analyze.py
+++ b/scripts/nlp_analyze.py
@@ -349,13 +349,13 @@ def main():
categories = result.get("categories", [])
if categories:
- print(f"\nContent Categories:")
+ print("\nContent Categories:")
for c in categories:
print(f" {c['name']} ({c['confidence']:.1%})")
moderation = result.get("moderation", [])
if moderation:
- print(f"\nModeration Flags:")
+ print("\nModeration Flags:")
for m in moderation:
print(f" {m['name']} ({m['confidence']:.1%})")
diff --git a/scripts/pagespeed_check.py b/scripts/pagespeed_check.py
index 70ce520..4ba0381 100644
--- a/scripts/pagespeed_check.py
+++ b/scripts/pagespeed_check.py
@@ -29,7 +29,6 @@ try:
from google_auth import (
get_api_key,
google_api_key_headers,
- load_config,
redact_google_api_key,
validate_url,
)
@@ -40,7 +39,6 @@ except ImportError:
from google_auth import (
get_api_key,
google_api_key_headers,
- load_config,
redact_google_api_key,
validate_url,
)
@@ -595,7 +593,7 @@ def _print_psi_summary(psi: dict):
diags = psi.get("diagnostics", [])
notable_diags = [d for d in diags if d.get("score") is not None and d["score"] < 0.9]
if notable_diags:
- print(f"\nDiagnostics (needs attention):")
+ print("\nDiagnostics (needs attention):")
for d in notable_diags[:5]:
score_pct = f"{d['score']:.0%}" if d['score'] is not None else "info"
print(f" [{score_pct}] {d['title']}: {d.get('display', '')}")
diff --git a/scripts/parasite_risk.py b/scripts/parasite_risk.py
index 26cc319..dd55eeb 100755
--- a/scripts/parasite_risk.py
+++ b/scripts/parasite_risk.py
@@ -52,7 +52,6 @@ if _SCRIPTS_DIR not in sys.path:
sys.path.insert(0, _SCRIPTS_DIR)
from url_safety import URLSafetyError, safe_requests_get # noqa: E402
-
# Indicators of third-party authored content. Each adds 1 hit per page.
_THIRD_PARTY_BYLINE_PATTERNS = (
r"\bPartner\s+Content\b",
diff --git a/scripts/parse_html.py b/scripts/parse_html.py
index 28ad39b..3674e4b 100755
--- a/scripts/parse_html.py
+++ b/scripts/parse_html.py
@@ -30,8 +30,7 @@ except ImportError:
_SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__))
if _SCRIPTS_DIR not in sys.path:
sys.path.insert(0, _SCRIPTS_DIR)
-from url_safety import safe_requests_get
-
+from url_safety import safe_requests_get # noqa: E402, I001
# Lazy-loader detection — covers native + the major JS lazy-loaders found on
# WordPress/WooCommerce sites (Perfmatters, EWWW Image Optimizer, generic
diff --git a/scripts/portability_check.py b/scripts/portability_check.py
index 6fe2a48..4d6f103 100644
--- a/scripts/portability_check.py
+++ b/scripts/portability_check.py
@@ -46,7 +46,6 @@ import re
import sys
from pathlib import Path
-
REPO_ROOT = Path(__file__).resolve().parents[1]
diff --git a/scripts/preload_check.py b/scripts/preload_check.py
index a1ad80e..5989c3c 100644
--- a/scripts/preload_check.py
+++ b/scripts/preload_check.py
@@ -62,7 +62,6 @@ if _SCRIPTS_DIR not in sys.path:
sys.path.insert(0, _SCRIPTS_DIR)
from url_safety import URLSafetyError, safe_requests_get # noqa: E402
-
_SPECULATION_BLOCK_RE = re.compile(
r'<script\b[^>]*\btype\s*=\s*["\']speculationrules["\'][^>]*>(?P<body>.*?)</script>',
re.IGNORECASE | re.DOTALL,
diff --git a/scripts/release_sign.py b/scripts/release_sign.py
index bfb6d6d..6e36a64 100644
--- a/scripts/release_sign.py
+++ b/scripts/release_sign.py
@@ -53,14 +53,12 @@ from __future__ import annotations
import argparse
import hashlib
import json
-import os
import subprocess
import sys
from datetime import datetime, timezone
from pathlib import Path
from typing import Iterable
-
REPO_ROOT = Path(__file__).resolve().parents[1]
diff --git a/scripts/schema_ecommerce_validate.py b/scripts/schema_ecommerce_validate.py
index 6b282da..b085f95 100644
--- a/scripts/schema_ecommerce_validate.py
+++ b/scripts/schema_ecommerce_validate.py
@@ -37,7 +37,6 @@ import json
import sys
from pathlib import Path
-
# Types Google retired June 2025 (announced via developers.google.com/search/blog
# /2025/06/simplifying-search-results). Generating any of these in 2026 is a
# Critical finding because the rich result no longer renders.
diff --git a/scripts/seo_updates.py b/scripts/seo_updates.py
index b9f7d4f..556f147 100644
--- a/scripts/seo_updates.py
+++ b/scripts/seo_updates.py
@@ -28,7 +28,6 @@ from datetime import date
from pathlib import Path
from typing import Iterable
-
_DATA_FILE = Path(__file__).resolve().parents[1] / "data" / "google-updates.json"
diff --git a/scripts/sync_flow.py b/scripts/sync_flow.py
index 8a0ccc7..f970d52 100644
--- a/scripts/sync_flow.py
+++ b/scripts/sync_flow.py
@@ -16,7 +16,6 @@ import urllib.error
import urllib.parse
import urllib.request
-
API_ROOT = "https://api.github.com/repos/AgriciDaniel/flow/contents"
_ALLOWED_HOST = "api.github.com"
_SIZE_LIMIT = 5 * 1024 * 1024 # 5 MB
diff --git a/scripts/ucp_check.py b/scripts/ucp_check.py
index 0582ef6..241cf26 100644
--- a/scripts/ucp_check.py
+++ b/scripts/ucp_check.py
@@ -35,7 +35,6 @@ import argparse
import json
import os
import sys
-from typing import Optional
from urllib.parse import urljoin, urlparse
_SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -47,7 +46,6 @@ from url_safety import ( # noqa: E402
validate_url_strict,
)
-
KNOWN_CAPABILITIES = {
"dev.ucp.shopping.checkout": "Initiate checkout, return totals + payment intent",
"dev.ucp.shopping.fulfillment": "Quote shipping options + delivery windows",
diff --git a/scripts/unlighthouse_run.py b/scripts/unlighthouse_run.py
index 7c337ca..7241a45 100644
--- a/scripts/unlighthouse_run.py
+++ b/scripts/unlighthouse_run.py
@@ -44,7 +44,6 @@ if _SCRIPTS_DIR not in sys.path:
sys.path.insert(0, _SCRIPTS_DIR)
from url_safety import URLSafetyError, validate_url_strict # noqa: E402
-
UNLIGHTHOUSE_PIN = "[email protected]"
diff --git a/scripts/validate_backlink_report.py b/scripts/validate_backlink_report.py
index 8713d83..f0cafb5 100644
--- a/scripts/validate_backlink_report.py
+++ b/scripts/validate_backlink_report.py
@@ -21,7 +21,6 @@ Input: JSON file with backlink analysis data containing keys:
import argparse
import json
import sys
-from typing import Optional
def validate_schema_claims(parsed_data: dict) -> list:
diff --git a/scripts/verify_backlinks.py b/scripts/verify_backlinks.py
index 8e34a26..fd8e199 100644
--- a/scripts/verify_backlinks.py
+++ b/scripts/verify_backlinks.py
@@ -16,7 +16,6 @@ import argparse
import json
import sys
import time
-from typing import Optional
from urllib.parse import urlparse
try:
@@ -26,12 +25,13 @@ except ImportError:
sys.exit(1)
import os
+
_SCRIPTS_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, _SCRIPTS_DIR)
try:
from fetch_page import fetch_page
- from parse_html import parse_html
from google_auth import validate_url
+ from parse_html import parse_html
from url_safety import URLSafetyError, safe_requests_head
except ImportError as e:
print(f"Error: Required scripts not found in scripts/: {e}", file=sys.stderr)
diff --git a/scripts/verify_release.py b/scripts/verify_release.py
index 061a934..1082a19 100644
--- a/scripts/verify_release.py
+++ b/scripts/verify_release.py
@@ -35,7 +35,6 @@ import json
import sys
from pathlib import Path
-
REPO_ROOT = Path(__file__).resolve().parents[1]
diff --git a/tests/test_banana_api_key_safety.py b/tests/test_banana_api_key_safety.py
index a464b83..cd39c84 100644
--- a/tests/test_banana_api_key_safety.py
+++ b/tests/test_banana_api_key_safety.py
@@ -10,7 +10,6 @@ from contextlib import redirect_stdout
from pathlib import Path
from unittest.mock import patch
-
REPO_ROOT = Path(__file__).resolve().parents[1]
SECRET = "AI" + "zaSyDUMMYSECRET"
QUERY_KEY = "ke" + "y"
diff --git a/tests/test_cross_platform_hooks.py b/tests/test_cross_platform_hooks.py
index 2f6f95e..8ae7e00 100644
--- a/tests/test_cross_platform_hooks.py
+++ b/tests/test_cross_platform_hooks.py
@@ -11,7 +11,6 @@ from pathlib import Path
import pytest
-
REPO_ROOT = Path(__file__).resolve().parents[1]
HOOKS_JSON = REPO_ROOT / "hooks" / "hooks.json"
HOOK_LAUNCHER = REPO_ROOT / "hooks" / "run-python-hook.js"
diff --git a/tests/test_drift_portability.py b/tests/test_drift_portability.py
index c421a85..7d323a2 100644
--- a/tests/test_drift_portability.py
+++ b/tests/test_drift_portability.py
@@ -9,7 +9,6 @@ from pathlib import Path
from types import SimpleNamespace
from unittest.mock import patch
-
REPO_ROOT = Path(__file__).resolve().parents[1]
SCRIPTS_DIR = REPO_ROOT / "scripts"
if str(SCRIPTS_DIR) not in sys.path:
diff --git a/tests/test_fetch_page_decoding.py b/tests/test_fetch_page_decoding.py
index 6608947..2db6f3a 100644
--- a/tests/test_fetch_page_decoding.py
+++ b/tests/test_fetch_page_decoding.py
@@ -5,7 +5,6 @@ from __future__ import annotations
import sys
from pathlib import Path
-
REPO_ROOT = Path(__file__).resolve().parents[1]
SCRIPTS_DIR = REPO_ROOT / "scripts"
if str(SCRIPTS_DIR) not in sys.path:
diff --git a/tests/test_gbp_lint_and_polish.py b/tests/test_gbp_lint_and_polish.py
index 1a4e06e..5285c3e 100644
--- a/tests/test_gbp_lint_and_polish.py
+++ b/tests/test_gbp_lint_and_polish.py
@@ -7,12 +7,9 @@ Tests for v2 Checkpoint 6 (Phase F — local + international + privacy polish):
from __future__ import annotations
-import os
import sys
from pathlib import Path
-import pytest
-
_REPO = Path(__file__).resolve().parents[1]
_SCRIPTS = _REPO / "scripts"
if str(_SCRIPTS) not in sys.path:
@@ -20,7 +17,6 @@ if str(_SCRIPTS) not in sys.path:
import gbp_deprecation_lint as gbp # noqa: E402
-
# ---------------------------------------------------------------------------
# gbp_deprecation_lint
# ---------------------------------------------------------------------------
diff --git a/tests/test_google_api_key_safety.py b/tests/test_google_api_key_safety.py
index d6ccaee..15dc651 100644
--- a/tests/test_google_api_key_safety.py
+++ b/tests/test_google_api_key_safety.py
@@ -25,7 +25,6 @@ import lcp_subparts # noqa: E402
import nlp_analyze # noqa: E402
import pagespeed_check # noqa: E402
-
SECRET = "AI" + "zaSyDUMMYSECRET"
QUERY_KEY = "ke" + "y"
QUERY_KEY_ASSIGNMENT = QUERY_KEY + "="
diff --git a/tests/test_google_report_full_audit.py b/tests/test_google_report_full_audit.py
index 5357881..b60d2b6 100644
--- a/tests/test_google_report_full_audit.py
+++ b/tests/test_google_report_full_audit.py
@@ -2,14 +2,13 @@
from __future__ import annotations
+import builtins
import os
import runpy
import sys
-import builtins
from pathlib import Path
from unittest.mock import patch
-
_SCRIPTS = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "scripts")
if _SCRIPTS not in sys.path:
sys.path.insert(0, _SCRIPTS)
diff --git a/tests/test_gsc_query.py b/tests/test_gsc_query.py
index 224846f..f3075a6 100644
--- a/tests/test_gsc_query.py
+++ b/tests/test_gsc_query.py
@@ -2,12 +2,10 @@
from __future__ import annotations
-import os
import sys
from pathlib import Path
from unittest.mock import patch
-
REPO_ROOT = Path(__file__).resolve().parents[1]
_SCRIPTS = REPO_ROOT / "scripts"
if str(_SCRIPTS) not in sys.path:
diff --git a/tests/test_moz_api.py b/tests/test_moz_api.py
index 79cf8ef..831539c 100644
--- a/tests/test_moz_api.py
+++ b/tests/test_moz_api.py
@@ -7,7 +7,6 @@ import os
import sys
from unittest.mock import patch
-
_SCRIPTS = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "scripts")
if _SCRIPTS not in sys.path:
sys.path.insert(0, _SCRIPTS)
diff --git a/tests/test_nlp_analyze.py b/tests/test_nlp_analyze.py
index 522e12e..b30c02b 100644
--- a/tests/test_nlp_analyze.py
+++ b/tests/test_nlp_analyze.py
@@ -6,7 +6,6 @@ import os
import sys
from unittest.mock import patch
-
_SCRIPTS = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "scripts")
if _SCRIPTS not in sys.path:
sys.path.insert(0, _SCRIPTS)
diff --git a/tests/test_parasite_risk_and_extensions.py b/tests/test_parasite_risk_and_extensions.py
index 57b4417..d097560 100644
--- a/tests/test_parasite_risk_and_extensions.py
+++ b/tests/test_parasite_risk_and_extensions.py
@@ -7,7 +7,6 @@ Tests for the v2 Checkpoint 5 deliverables:
from __future__ import annotations
-import os
import stat
import sys
from pathlib import Path
@@ -21,7 +20,6 @@ if str(_SCRIPTS) not in sys.path:
import parasite_risk # noqa: E402
-
# ---------------------------------------------------------------------------
# parasite_risk
# ---------------------------------------------------------------------------
diff --git a/tests/test_portability.py b/tests/test_portability.py
index 53b0772..1f503f9 100644
--- a/tests/test_portability.py
+++ b/tests/test_portability.py
@@ -6,12 +6,9 @@ Tests for v2 Checkpoint 7 (Phase G + I):
from __future__ import annotations
-import os
import sys
from pathlib import Path
-import pytest
-
_REPO = Path(__file__).resolve().parents[1]
_SCRIPTS = _REPO / "scripts"
if str(_SCRIPTS) not in sys.path:
@@ -19,7 +16,6 @@ if str(_SCRIPTS) not in sys.path:
import portability_check as pc # noqa: E402
-
# ---------------------------------------------------------------------------
# portability_check
# ---------------------------------------------------------------------------
diff --git a/tests/test_sync_flow.py b/tests/test_sync_flow.py
index 37627e1..3f4f77f 100644
--- a/tests/test_sync_flow.py
+++ b/tests/test_sync_flow.py
@@ -1,5 +1,6 @@
"""Tests for scripts/sync_flow.py"""
+import importlib.util as _ilu
import json
import subprocess
import sys
@@ -104,10 +105,6 @@ def test_agent_has_untrusted_webfetch_rule():
)
-# ── Module-level loader for unit tests (no network calls) ─────────────────────
-
-import importlib.util as _ilu
-
def _load_sync_flow_module():
path = REPO_ROOT / "scripts" / "sync_flow.py"
spec = _ilu.spec_from_file_location("sync_flow", path)
diff --git a/tests/test_technical_depth.py b/tests/test_technical_depth.py
index 5896fbf..54cbf2e 100644
--- a/tests/test_technical_depth.py
+++ b/tests/test_technical_depth.py
@@ -18,18 +18,15 @@ import os
import sys
from unittest.mock import patch
-import pytest
-
_SCRIPTS = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "scripts")
if _SCRIPTS not in sys.path:
sys.path.insert(0, _SCRIPTS)
-import preload_check # noqa: E402
import indexnow_submit # noqa: E402
import lcp_subparts # noqa: E402
+import preload_check # noqa: E402
import unlighthouse_run # noqa: E402
-
# ---------------------------------------------------------------------------
# preload_check
# ---------------------------------------------------------------------------
diff --git a/tests/test_url_safety.py b/tests/test_url_safety.py
index 24de833..cf0e87c 100644
--- a/tests/test_url_safety.py
+++ b/tests/test_url_safety.py
@@ -27,7 +27,6 @@ if _SCRIPTS not in sys.path:
import url_safety # noqa: E402
-
# ---------------------------------------------------------------------------
# normalize_hostname (v2 self-audit: closes obfuscated-IPv4 + FQDN bypasses)
# ---------------------------------------------------------------------------
@@ -538,6 +537,7 @@ def test_save_oauth_token_remediates_legacy_0o644(tmp_path, monkeypatch) -> None
def test_save_oauth_token_without_fchmod_closes_descriptor(tmp_path, monkeypatch) -> None:
"""Windows has no os.fchmod; persistence must still succeed and close fd."""
import json
+
import google_auth # noqa: WPS433
target = tmp_path / "config" / "oauth-token.json"
@@ -566,6 +566,7 @@ def test_save_oauth_token_without_fchmod_closes_descriptor(tmp_path, monkeypatch
def test_save_oauth_token_ignores_fchmod_oserror(tmp_path, monkeypatch) -> None:
"""Filesystems without descriptor chmod support must still persist tokens."""
import json
+
import google_auth # noqa: WPS433
target = tmp_path / "config" / "oauth-token.json"