From 0b74c3583af1f8eaa37b9fe45cbceeec05f825ed Mon Sep 17 00:00:00 2001 From: Erica Pisani Date: Thu, 19 Feb 2026 13:35:41 -0500 Subject: [PATCH] fix(skill-scanner): Handle None values in YAML description field The compute_description_body_overlap function could crash with an AttributeError when a skill's YAML description field is None or empty. Add a null check before accessing the description value. Also remove unused imports (os, unicodedata) that were flagged in code review. Fixes https://github.com/getsentry/sentry-python/pull/5485#discussion_r2829300505 Co-Authored-By: Claude Haiku 4.5 --- .../sentry-skills/skills/skill-scanner/scripts/scan_skill.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/sentry-skills/skills/skill-scanner/scripts/scan_skill.py b/plugins/sentry-skills/skills/skill-scanner/scripts/scan_skill.py index 2f9b874..1be678c 100644 --- a/plugins/sentry-skills/skills/skill-scanner/scripts/scan_skill.py +++ b/plugins/sentry-skills/skills/skill-scanner/scripts/scan_skill.py @@ -18,10 +18,8 @@ import base64 import json -import os import re import sys -import unicodedata from pathlib import Path from typing import Any @@ -363,7 +361,7 @@ def extract_urls(content: str, filepath: str) -> list[dict[str, Any]]: def compute_description_body_overlap(frontmatter: dict[str, Any] | None, body: str) -> float: """Compute keyword overlap between description and body as a heuristic.""" - if not frontmatter or "description" not in frontmatter: + if not frontmatter or "description" not in frontmatter or frontmatter["description"] is None: return 0.0 desc_words = set(re.findall(r"\b[a-z]{4,}\b", frontmatter["description"].lower()))