feat(code-reviewer): wire Java into analyzer + complete the universal/per-language refactor#749
Conversation
- Extract commun languages rules in a separate rules/universal.md containing all cross-language rules in one place - Move language-specific rules inline into each languages/*.md file, organised into consistent sections: Security / Async / Resource Management / Exception Handling / Performance / Idioms - Add Java support: languages/java.md with full section coverage - Every review now requires exactly 2 file reads: universal.md + one language file - Add "Adding a new language" guide to SKILL.md: one file to create, nothing else changes
Builds on @mitnick2012's universal+per-language restructure (PR #742). - Add Java as a first-class deterministic language in code_quality_checker.py (LANGUAGE_EXTENSIONS + function/class/method patterns + check_java_specific_smells), so the documented `--language java` command works instead of erroring on an invalid choice. Add Java debug + @SuppressWarnings signals to pr_analyzer.py. - Add Java regression fixtures (sample_java_smells/clean.java) with committed expected_outputs JSON, mirroring the existing C# fixtures. - Delete references/{code_review_checklist,coding_standards,common_antipatterns}.md, now duplicated by rules/universal.md + languages/*.md; repoint README and the C# clean fixture header at the new structure. - Document the optional analyzer-wiring + fixture steps in the "Adding a New Language" guide and restore a Regression Fixtures section in SKILL.md. https://claude.ai/code/session_01DjuELpoFdFbFscr3kAatni
Code Review — PR #749Overall: Solid, well-scoped PR. The Java wiring is real and follows the established C# pattern correctly. The documentation refactor is clean. A few issues worth fixing before merge. Bugs / Correctness1. Hardcoded absolute path in expected-output JSON breaks the regression harness Both new expected-output files embed 2. False positives in The negative lookahead try (InputStream in = new FileInputStream("a");
OutputStream out = new FileOutputStream("b")) { // flagged incorrectly
|
Minor Issues3. The inline comment explains the call is safe (same 4. README and SKILL.md use different diff commands README uses the temp-file form ( 5. Deleted The old checklist had "Pre-Review Checks", "Testing", "Documentation", and "Review Process Tips" sections that have no equivalent in the new What Is Well Done
Bottom line: Items 1 (hardcoded path in JSON) and 2 (multi-line TWR false positive) are worth fixing before merge. Items 3–5 are polish. The core changes are correct and well-executed. |
Summary
Builds on @mitnick2012's code-reviewer restructure (#742) and finishes the two gaps that review surfaced, so this can merge in place of #742.
1. "Java support" is now real, not documentation-only. #742 advertised
--language javaand a.javadispatch row, but the scripts were untouched —code_quality_checker.pyrejectedjavaas an invalid--languagechoice and never discovered.javafiles. This PR wires Java in as a first-class deterministic language:LANGUAGE_EXTENSIONS+function/class/methodregex patterns for Java (so it no longer falls back to the Python patterns)check_java_specific_smells()detector (empty catch,printStackTrace, swallowedInterruptedException, unclosedAutoCloseable, per-callObjectMapper/Gson) called fromanalyze_fileSystem.out,printStackTrace) +@SuppressWarningsadded topr_analyzer.py2. Completed the refactor / removed the drift. #742 moved the reference content into
rules/universal.md+languages/*.mdbut left the oldreferences/*.mdin place (still linked from README) — duplicated content that would drift. This PR deletes the three now-duplicated reference files and repoints README + the C# clean fixture header at the new structure.3. Java regression fixtures, mirroring the existing C# ones:
assets/sample_java_smells.java+sample_java_clean.javawith committedexpected_outputs/*.jsonas a drift guard. The "Adding a New Language" guide now documents the optional analyzer-wiring + fixture steps, and a Regression Fixtures section is restored toSKILL.md.Verification
--language javanow valid; smells fixture → grade D with all 5 Java smells firing; clean fixture → grade A/100, no Java smells (singletonObjectMappercorrectly not flagged).--help;pr_analyzer.pyimports clean and the new Java regexes match.references/; no dangling sync symlinks.Credit
Restructure +
languages/*.md+ java.md authored by @mitnick2012 (#742). This branch adds the analyzer wiring, fixtures, and cleanup on top. Suggest merging this and closing #742 as superseded.https://claude.ai/code/session_01DjuELpoFdFbFscr3kAatni
Generated by Claude Code