Skip to content

ci: fail on unsupported JSON initializer patterns - #231

Open
agammann wants to merge 1 commit into
Blockstream:masterfrom
agammann:ci/enforce-json-initializer-checks
Open

agammann wants to merge 1 commit into
Blockstream:masterfrom
agammann:ci/enforce-json-initializer-checks

Conversation

@agammann

Copy link
Copy Markdown

The two JSON initializer guards in test_format print a diagnostic when they find a prohibited pattern, but then run echo exit 1. Because that command succeeds, the checks do not fail the job when they detect a violation.

Replace echo exit 1 with exit 1 in both guards so a match stops the job as intended. The existing search patterns and diagnostics are preserved.

Validation used the exact guard commands in isolated Bash scripts with set -e. A fixture containing auto other = nlohmann::json({}); and an indented nlohmann::json fixture({}); made both original guards print their diagnostic and exit 0. Both corrected guards exit 1 for that fixture and exit 0 for an allowed auto allowed = j_empty; fixture. Both corrected guards also pass against the current repository source. git diff --check passed.

The full GitLab pipeline and application build were not run.

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