Adopt Senzing java-coding-standards#116
Conversation
Adopt the shared java-coding-standards as done in senzing-commons-java,
pinned to release 0.4.1 via a .java-coding-standards git submodule.
- Add .java-coding-standards submodule (pinned to tag 0.4.1).
- pom.xml: point the checkstyle profile at the shared
senzing-checkstyle.xml (drop the local <suppressionsLocation>); add the
surefire <argLine>@{argLine} -XX:+EnableDynamicAgentLoading -Xshare:off</argLine>
plus an empty top-level <argLine> property.
- Remove the now-superseded blanket checkstyle-suppressions.xml.
- Add the FAQ MCP server (.mcp.json -> sz-sdk-java-auto-faq) plus four
starter project FAQs under .claude/faqs/.
- Wire VSCode: .vscode/settings.json (format-on-save via emeraldwalk),
tasks.json, extensions.json; add !exceptions in .gitignore so they are
tracked.
- Install the /init-java slash command and Claude Code hooks
(PostToolUse auto-format, Stop checkstyle, SessionStart freshness nudge).
- Merge the Java Coding Standards / FAQ MCP / Testing sections into CLAUDE.md.
Apply the shared formatter (.java-coding-standards 0.4.1 tooling/scripts/format_file.py) across src/main/java and src/test/java. Mechanical formatting only; no behavioral changes. A handful of lines the AST formatter cannot auto-wrap were adjusted by hand to satisfy the now-enforced 80-column LineLength check: long String-literal messages split into concatenations, two for-loop conditions wrapped, and one unwrappable generic class declaration bracketed with // CSOFF / // CSON. Formatter output is idempotent (0 modifications on a second run) and mvn -Pcheckstyle validate reports BUILD SUCCESS.
Code Coverage
|
Add the dictated third-party/tool terms cspell cannot resolve to the dictionary (CSOFF checkstyle marker, emeraldwalk/runonsave VSCode extension id, esac bash keyword in the standards hook, ctxt BlueJ file extension, Allman brace-style term from the standards doc). Reword the 'subclassing' FAQ prose to 'extensibility' rather than dictionary it, since that text is ours to change.
🤖 Claude Code ReviewCombined Code ReviewReview Part 1 of 2Heads up: .java-coding-standards has a newer release available (1.0.1); current pin is untagged. Run /init-java to refresh. Code Review — Part 1 of 2This PR adopts the Senzing Java coding standards submodule, reformats all Java source to comply, wires up tooling (VSCode, hooks, MCP FAQ server), and updates the checkstyle configuration. Review below. Code Quality✅ Style guide — Java reformatting broadly follows the Senzing standards: Allman braces on method/class bodies, same-line braces for control flow, 80-char line wrapping, operators at start of continuation lines. ❌ CSOFF/CSON misuse — // CSOFF
public abstract static class AbstractBuilder<E extends SzAutoCoreEnvironment,
B extends AbstractBuilder<E, B>>
extends SzCoreEnvironment.AbstractBuilder<E, B> implements Initializer
{
// CSONPer the CLAUDE.md standards: CSOFF/CSON is "only for deliberately aligned multi-line output (column-formatted diagnostics, ASCII art, SQL DDL) — never a general escape hatch." Suppressing line-length for a generic class signature is exactly the general escape hatch scenario the policy prohibits. The class signature should instead be reformatted to fit (e.g. split across lines in a compliant way without suppression). ❌ Awkward operator-split conditions — Two places produce hard-to-read continuations:
if (duration
== null || duration.isZero() || this.env.isDestroyed()) {
if (this.refreshMode
== RefreshMode.DISABLED || Boolean.TRUE.equals(
ENSURING_CONFIG.get()) || (!Boolean.TRUE.equals(
CONFIG_RETRY_FLAG.get()))) {The ❌ Arithmetic continuation — long delay = duration.getSeconds()
* ONE_THOUSAND + (duration.getNano() / ONE_MILLION);
✅ No commented-out code — cleaned up throughout. ✅ Meaningful names — no renames, existing names preserved. ✅ No defects introduced — the functional logic is unchanged; this is a pure reformat + tooling addition. Testing✅ No test logic changed — all test file changes are formatting-only. ✅ Documentation✅ CLAUDE.md — additions are well-structured and match what's documented in the system-level context. ✅ FAQ files — all four new files ( ❌ Javadoc tag in Markdown —
❌ No CHANGELOG.md update — this PR deletes Security✅ No hardcoded credentials. ✅ No ✅ SessionStart hook — the shell snippet validates case "$latest" in *[!A-Za-z0-9._-]*) exit 0 ;; esac;Good. The ✅ PostToolUse hook — ✅ Stop hook — runs read-only Maven validation. No risk. Minor / Nits
features
.values()
.forEach((jsonVal) -> {Breaking a two-method chain across three lines is technically standards-compliant (break before Summary
The PR is structurally sound — the submodule wiring, hook logic, FAQ server, and pom.xml changes are all correct. The blocking items are the CSOFF misuse, the condition-split formatting at a few sites, the Javadoc tag in the FAQ, and the missing CHANGELOG entry. Review Part 2 of 2Heads up: .java-coding-standards has a newer release available (1.0.1); current pin is untagged. Run /init-java to refresh. Code Review — Part 2 of 2This diff is a reformatting pass to adopt Senzing Java coding standards. Most changes are correct (Allman braces on method/class/constructor definitions, Code Quality❌ Builder-chain reformatting violates the The standards doc (CLAUDE.md) states: "Operators on continuation lines: break before The new builder chain style breaks that rule in every test file. Example from // New (non-conforming) — breaks mid-parameter-list, '.' not at line start
this.env = SzAutoCoreEnvironment.newAutoBuilder().instanceName(
instanceName).settings(settings).verboseLogging(false).concurrency(
this.getConcurrency()).configRefreshPeriod(
this.getConfigRefreshPeriod()).build();Conforming form: this.env = SzAutoCoreEnvironment.newAutoBuilder()
.instanceName(instanceName)
.settings(settings)
.verboseLogging(false)
.concurrency(this.getConcurrency())
.configRefreshPeriod(this.getConfigRefreshPeriod())
.build();This pattern repeats in: ❌ Inline comments detached from their target lines — Before (~line 88): this.bumpConfig(); // ensure config is out of syncAfter: this.bumpConfig();
// ensure config is out of sync
return super.ensureConfigCurrent();The comment now appears between the ✅ Allman brace placement — All method/class/constructor definitions now correctly put ✅ ✅ Import group blank lines — Removed blank lines between import groups. The formatter produces this; verify with ✅ DiagnosticTest.java annotation alignment — The pre-existing leading-space indentation bug on class annotations is correctly fixed. ✅ No commented-out code introduced. ✅ No DRY violations introduced. Testing✅ No functional changes; no new test logic was added. Existing tests are unchanged in behavior. Documentation❌ CHANGELOG.md — Not visible in this diff. If not updated, confirm this formatting-only pass is intentionally changelog-exempt. ✅ No API changes; no README/API doc updates needed. Security✅ No credentials, no input validation changes, no sensitive data in logs. Pure formatting. Summary
Automated code review analyzing defects and coding standards |
Summary
Adopts the shared
java-coding-standardsas done in
senzing-commons-java, pinned to release 0.4.1 via a.java-coding-standardsgit submodule. Generated by running the standards'adoption playbook (
/init-java).Wiring (commit
ae0c5c3).java-coding-standardspinned to tag0.4.1.senzing-checkstyle.xml(dropped the local<suppressionsLocation>); addedthe surefire
<argLine>@{argLine} -XX:+EnableDynamicAgentLoading -Xshare:off</argLine>and an empty top-level
<argLine>property.checkstyle-suppressions.xml..mcp.jsonregisterssz-sdk-java-auto-faq; four starterproject FAQs added under
.claude/faqs/(architecture, build commands,config-refresh modes, native-lib test setup).
.vscode/settings.json(format-on-save viaemeraldwalk),tasks.json,extensions.json;.gitignoregains!exceptions so they aretracked.
/init-javaslash command; hooks in.claude/settings.json(PostToolUse auto-format, Stop checkstyle, SessionStart freshness nudge).
Reformat (commit
d9391bf)Mechanical formatting of all 29 files under
src/main/java+src/test/javavia the shared formatter. No behavioral changes. A few lines the AST formatter
cannot auto-wrap were adjusted by hand to satisfy the now-enforced 80-column
limit (string-literal splits, two
forconditions, one// CSOFF/CSONon anunwrappable generic declaration).
Verification
mvn -Pcheckstyle validate→ BUILD SUCCESSmvn test-compile→ BUILD SUCCESSmvn test(native libs) not run in this environment — please confirm on a CI/dev box.Reviewer / merge notes
sz-sdk-java-auto-faqMCP server indexes.submodules: recursive.