feat(classifier): add R31 abstract modifier added rule - #32
Conversation
|
@Aakif-Kohari is attempting to deploy a commit to the Aryan Gupta's projects Team on Vercel. A member of the Team first needs to authorize it. |
Note: Tracking "Abstract → Concrete" as an Advisory ChangePR 32 correctly identifies when a method goes from The Issue The Approach After making this minor change, i will merge your PR. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
5d3c1fa to
e19a2e1
Compare
|
@Aryan0628 Good catch, agreed - makes sense to surface it rather than drop it silently. Updated R31_abstract_modifier_added.ts to return a safe-severity advisory result on the abstract → concrete direction, with a message pointing out that existing overrides are now optional. Updated the doc comment and swapped the now-inaccurate "must return null" test for one asserting the new advisory result. Pushed as a separate commit so the original logic and this follow-up stay easy to review independently. |
Summary
Adds classification rule R31: Abstract Modifier Added.
src/classifier/rules/R31_abstract_modifier_added.ts— new rule, flags when a concrete method gains theabstractmodifier (concrete → abstract only; the reverse direction is safe and not flagged).src/classifier/rules/index.ts— exports the new rule.tests/rules/function-rules.test.ts— 4 new test cases (true positive, safe reverse direction, both-concrete, undefined/undefined edge case).tests/e2e/ast-e2e.test.ts— 1 new E2E case through the full WASM parse → classify pipeline.README.md,CONTRIBUTING.md— rule count bumped to 29.client/src/components/Terminal.tsx,client/src/components/docs/DocsSidebar.tsx,client/src/content/docs/cli-rules.tsx,client/src/content/docs/rules-data.ts— docs site updated with the new rule entry.No new dependencies.
isAbstractwas already populated by every language translator (TypeScript, Python, Go, Java, Rust) — this PR only adds the missing rule that consumes it.I have solved this Issue under
ECSoC26.Closes #29
Testing
npm testpasses (all existing + 5 new tests)npm run lintpassesnpm run buildsucceedsnpx dg checkverified on a throwaway abstract-conversion diff — fires correctly on concrete→abstract, silent on abstract→concreteBreaking changes
None to the tool itself — this only adds new detection coverage.