Skip to content

Validate argument keys and fix -se short form#54

Open
micheleh wants to merge 1 commit intomasterfrom
fix/validate-arg-keys-and-se-shortform
Open

Validate argument keys and fix -se short form#54
micheleh wants to merge 1 commit intomasterfrom
fix/validate-arg-keys-and-se-shortform

Conversation

@micheleh
Copy link
Copy Markdown
Collaborator

@micheleh micheleh commented Apr 5, 2026

Summary

  • parseArgs() now validates parameter keys against a known set and throws IllegalArgumentException for unknown keys (e.g., typo --reportFile instead of --reportFiles)
  • Added -se (single dash) as a recognized boolean flag alongside --se and --systemErrors, matching what the help text documents
  • Both -se and --se work for backwards compatibility

Context

Since the initial commit (c71ed1f, 2021-11-15), parseArgs() accepted any --key=value without checking if the key was known. A typo like --reportFile=foo.xml (missing 's') would be silently stored, then the user would get a confusing "Parameter --reportFiles or -rf is missing" error with no hint about the typo.

Additionally, the help text documented -se (single dash) as the short form for --systemErrors, but the code only recognized --se (double dash). A user typing -se per the help would get System.exit(1).

Verification

  • Unknown parameters (--reportFile, --bogus) are rejected with IllegalArgumentException
  • Valid long and short form parameters still accepted
  • -se works as a bare boolean flag (like --se)
  • --se still works for backwards compatibility
  • Full test suite passes (42 tests, 0 failures)

parseArgs() now rejects unknown parameter keys with a clear error
instead of silently accepting them. Added -se (single dash) as a
recognized boolean flag alongside --se, matching the help text.
Both -se and --se continue to work for backwards compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@micheleh micheleh requested a review from nissimshitrit April 5, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant