Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.
Python agent-evaluationagent-pluginsagent-securityagent-skillsagentic-aibenchmarkci-templatesclaude-codecodexevaluateevaluationharnesspluginplugin-evaluationsecurity-scannerskill-evalskill-evaluationskill-evaluatorskill-gap-analysisskills
fix(lint): inspect Python scripts with a UTF-8 BOM (#677)
PM92a5cf26f021
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex cabc0d78..0115cd5a 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -471,6 +471,7 @@ All notable changes to SkillEvaluator are documented in this file.incomplete cases are reported as unresolved instead of failed.- Partially executed evaluation arms retain scored attempts and per-arm scores without treating missing attempts as failures or enabling aggregate comparisons.+- Script lint now runs advisory AST checks on Python files with one leading UTF-8 BOM.- Failed Tier 3 arms retain scored and errored trial activation diagnostics without restoring aggregate quality or lift, or double-counting token usage.- Budget-limited Tier 3 coverage checks retain admitted attempt ordinals, avoiding false missing/excess errors when a denied slot leaves a gap.- HTML reports retain budget context for fully budget-denied runs withoutdiff --git a/docs/tier1-validation.mdx b/docs/tier1-validation.mdxindex 653c639a..d066e00e 100644--- a/docs/tier1-validation.mdx+++ b/docs/tier1-validation.mdx@@ -597,7 +597,7 @@ For `validate`, the default set is `schema`, `version`, `security`, `pii`, `lice| `flat_script` | MEDIUM | No function definitions || `deep_nesting` | MEDIUM | Control-flow nesting deeper than 6 || `magic_numbers` | LOW | Raw numeric constants outside the safe constant set |- | `missing_shebang` | LOW | No leading shebang (`#!`) |+ | `missing_shebang` | LOW | No leading shebang (`#!`), or a shebang preceded by a UTF-8 BOM || `no_input_validation` | LOW | No `argparse`, `click`, `typer`, or explicit raise pattern |</Accordion>diff --git a/src/skillevaluator/validators/script_lint.py b/src/skillevaluator/validators/script_lint.pyindex 6e86b06c..00e1ce68 100644--- a/src/skillevaluator/validators/script_lint.py+++ b/src/skillevaluator/validators/script_lint.py@@ -189,7 +189,7 @@ class ScriptLintValidator(ValidatorBase):returntry:- tree = ast.parse(content, filename=script.name)+ tree = ast.parse(content.removeprefix("\ufeff"), filename=script.name)except SyntaxError:return@@ -232,15 +232,24 @@ class ScriptLintValidator(ValidatorBase):))- if not content.startswith("#!"):+ shebang_warning = None+ if content.startswith("\ufeff#!"):+ shebang_warning = (+ f"{fname} shebang is preceded by a UTF-8 BOM and will be ignored",+ "Save the file as UTF-8 without a BOM",+ )+ elif not content.startswith("#!"):+ shebang_warning = (f"{fname} missing shebang line", "Add: #!/usr/bin/env python3")++ if shebang_warning:result.add_finding(Finding(category="SCRIPT_LINT",severity=Severity.LOW,check_name="missing_shebang",- message=f"{fname} missing shebang line",+ message=shebang_warning[0],file_path=str(script),- suggestion="Add: #!/usr/bin/env python3",+ suggestion=shebang_warning[1],))diff --git a/tests/validators/test_script_lint.py b/tests/validators/test_script_lint.pyindex e6d29628..780c2b12 100644--- a/tests/validators/test_script_lint.py+++ b/tests/validators/test_script_lint.py@@ -23,6 +23,34 @@ def skill_with_scripts(tmp_path: Path) -> Path:class TestScriptLintValidator:+ @pytest.mark.parametrize("prefix", [b"", b"\xef\xbb\xbf"], ids=["plain", "utf8-bom"])+ def test_utf8_bom_scripts_receive_ast_lint_findings(self, skill_with_scripts, prefix):+ script = skill_with_scripts / "scripts" / "example.py"+ script.write_bytes(prefix + b"import sys\nprint(sys.argv)\n")++ result = ScriptLintValidator().validate(skill_with_scripts)++ assert {finding.check_name for finding in result.findings} == {+ "flat_script",+ "missing_shebang",+ "no_input_validation",+ }+ assert result.passed+ assert not any("passed lint checks" in detail.message for detail in result.success_details)++ def test_utf8_bom_keeps_raw_shebang_check(self, skill_with_scripts):+ script = skill_with_scripts / "scripts" / "example.py"+ script.write_bytes(b"\xef\xbb\xbf#!/usr/bin/env python3\nprint('hello')\n")++ result = ScriptLintValidator().validate(skill_with_scripts)++ checks = {finding.check_name for finding in result.findings}+ assert "flat_script" in checks+ assert "missing_shebang" in checks+ shebang_finding = next(finding for finding in result.findings if finding.check_name == "missing_shebang")+ assert shebang_finding.message == "example.py shebang is preceded by a UTF-8 BOM and will be ignored"+ assert shebang_finding.suggestion == "Save the file as UTF-8 without a BOM"+def test_no_scripts_dir(self, tmp_path):skill_dir = tmp_path / "no-scripts"skill_dir.mkdir()@@ -181,13 +209,22 @@ class TestScriptLintValidator:result = v.validate(skill_with_scripts)assert not result.findings- def test_syntax_error_skipped(self, skill_with_scripts):+ @pytest.mark.parametrize(+ "source",+ [+ "def broken(:\n pass\n",+ "\ufeff\ufeffprint(1)\n",+ "\n\ufeffprint(1)\n",+ ],+ ids=["syntax-error", "double-leading-bom", "non-leading-bom"],+ )+ def test_syntax_error_skipped(self, skill_with_scripts, source):scripts = skill_with_scripts / "scripts"- (scripts / "broken.py").write_text("def broken(:\n pass\n")- v = ScriptLintValidator()- result = v.validate(skill_with_scripts)- # Syntax errors should be silently skipped- assert "read_error" not in [f.check_name for f in result.findings]+ (scripts / "broken.py").write_text(source, encoding="utf-8")+ result = ScriptLintValidator().validate(skill_with_scripts)++ assert result.findings == []+ assert result.passeddef test_validator_name(self):v = ScriptLintValidator()