Skip to content

style(cli): add braces to remaining single-line if statements (#420 task 4) - #1228

Open
prx-my wants to merge 2 commits into
OWASP:mainfrom
prx-my:feature/issue-420-ts-quality
Open

prx-my wants to merge 2 commits into
OWASP:mainfrom
prx-my:feature/issue-420-ts-quality

Conversation

@prx-my

@prx-my prx-my commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

What changed and why

Adds braces to the remaining single-line if statements, so every if
body is a block. Pure brace-only change - no conditions, logic, error
messages or behaviour changed.

  • src/cli/args.ts: 10 single-line ifs wrapped (ca-cert serial/=,
    config set key/value, config unset key, base serial/=,
    output serial/=, final ca-cert serial)
  • src/index.ts: 1 single-line if at the validationWarning branch

Verified with a normalized comparison (all whitespace and {/} stripped):
both files are identical to HEAD, confirming the diff adds braces only.

Part of #420 (task 4). The issue text says 8 in args.ts, but current
main has 10 - the two --output requires a directory argument guards
landed after the audit - so both are included here.

npm test and npm run build pass.

Closes 4th bullet of #420 ; other bullets in #420
remain separate PRs.

Copilot AI lite review requested due to automatic review settings September 23, 2026 17:29
@prx-my
prx-my requested a review from sonukapoor as a code owner September 23, 2026 17:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@prx-my prx-my changed the title style(cli): add braces to remaining single-line if statements style(cli): add braces to remaining single-line if statements (#420 task 4) Sep 23, 2026
sonukapoor
sonukapoor previously approved these changes Sep 24, 2026

@sonukapoor sonukapoor left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, and I owe you a note on how this nearly went wrong at my end.

On first run this failed 32 tests across 6 suites and looked like a real regression. It was not. Every failure was on --offline, and the cause was my machine: I had destroyed my local advisory database earlier while testing something unrelated. main failed identically once I checked it as a control. After rebuilding the database, your branch is 151 suites and 2041 tests green, same as main.

On the change itself, I verified the braces-only claim rather than taking it on trust: stripped every brace and normalised whitespace from both versions of src/cli/args.ts and src/index.ts, and the files are identical to main. So no condition, body or message moved.

Sequencing: this conflicts with #1230 on src/cli/args.ts, confirmed by test-merging. If #1230 goes first you will need a rebase here, and I think that is the right order since the braces reapply more easily than the constant extraction would.

@prx-my

prx-my commented Sep 24, 2026

Copy link
Copy Markdown
Contributor Author

Will do rebase soon

Wrap the 10 single-line if statements in src/cli/args.ts and the one in
src/index.ts in braces. Pure brace-only change: conditions, error
messages and behaviour are unchanged.

Task 4 of OWASP#420. The --output guards are included since they are
single-line ifs on current main.

This branch has not been deployed

No deployments
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.

3 participants