Repository navigation
Tighten rules and add Vercel-style validate/extract pipeline - #1
Merged
Merged
Conversation
Fixes incorrect or overstated rules surfaced in review: - api-deprecated-aliases: warnings.deprecated() (not typing) for funcs/classes; compatibility kwarg + warnings.warn for parameter renames - Split error-assert-invariants into error-assert-debug-only (notes -O strips asserts) and error-assert-never-exhaustiveness - perf-isinstance-tuple-syntax: demoted to "only on profiled hot paths" - error-trust-validated-state: narrowed with a 4-item trust-domain checklist (immutability, locality, no untyped callers, no rehydration) - simplify-cached-property: adds thread-safety, __dict__/slots, and idempotency caveats - data-encapsulate-mutable-state: reframed as "narrowest clear scope" rather than "closures over instance attrs" - perf-generator-over-list: reframed as a streaming/memory rule - api-instance-vs-module-fn: reframed as "simplest namespace that matches ownership and polymorphism" - error-specific-exceptions: distinguishes broad except Exception: from bare except: New rules: - error-no-bare-except, data-mutable-defaults, error-context-managers, api-no-boolean-flag-params, data-sentinel-when-none-is-valid, imports-no-side-effects, data-aware-datetimes Pipeline / repo: - metadata.json + SKILL.md declare Python 3.11+ floor - Pydantic-specific rules tagged applicability:pydantic - _template.md adds a required `references:` line for any rule that cites a Python version, PEP, or version-sensitive API - README documents src/, build/validate/extract pipeline, and reference policy - src/validate.py: lints frontmatter, structure, references - src/extract_tests.py: generates test-cases.json for LLM evals 71 rules, 0 validation failures, 71 test cases extracted. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
api-deprecated-aliaseshadtyping.deprecatedinstead ofwarnings.deprecated, anderror-assert-invariantsblended two distinct ideas)src/validate.py,src/extract_tests.py, generatedtest-cases.json_template.mdto require primary-sourcereferencesfor version-/library-dependent rules71 rules, 0 validation failures, 71 test cases extracted.
Rule fixes
api-deprecated-aliases— usewarnings.deprecated()(3.13+) for funcs/classes; compatibility kwarg +warnings.warnfor parameter renameserror-assert-invariants→error-assert-debug-only(notes-Ostrips asserts) +error-assert-never-exhaustivenessperf-isinstance-tuple-syntax— demoted to "only on profiled hot paths"error-trust-validated-state— narrowed with a 4-item trust-domain checklistsimplify-cached-property— adds thread-safety,__dict__/slots, and idempotency caveatsdata-encapsulate-mutable-state— reframed as "narrowest clear scope"perf-generator-over-list— reframed as a streaming/memory ruleapi-instance-vs-module-fn— reframed as "simplest namespace that matches ownership and polymorphism"error-specific-exceptions— distinguishes broadexcept Exception:from bareexcept:New rules
error-no-bare-except,data-mutable-defaults,error-context-managers,api-no-boolean-flag-params,data-sentinel-when-none-is-valid,imports-no-side-effects,data-aware-datetimesPipeline / repo
src/validate.py— lints frontmatter, structure, references; required references trigger on concrete signals (Python 3.X+, PEP NNN,warnings.deprecated,cached_property,assert_never,zoneinfo,KW_ONLY,ExceptionGroup,CancelledError,asyncio,pydantic,TypeAdapter,BaseModel,model_validator,model_dump,mypy,pyright,ruff)src/extract_tests.py— generatestest-cases.jsonfor LLM evalsmetadata.json+SKILL.mddeclare Python 3.11+ floorsrc/, the build/validate/extract pipeline, and the reference policyTest plan
python src/validate.py— 71 rules, 0 failurespython src/build.py— 8 sections, 71 rules, 186,855 bytespython src/extract_tests.py— 71 cases extracted, 0 skippedapi-deprecated-aliases, both newerror-assert-*rules,error-trust-validated-state,simplify-cached-property,perf-isinstance-tuple-syntax)data-mutable-defaults,error-context-managers,data-aware-datetimes)🤖 Generated with Claude Code