-
Notifications
You must be signed in to change notification settings - Fork 0
Emit Ninja manifest for Netsukefile test assertions #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| #!/usr/bin/env bash | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (review_instructions): Add both behavioural and unit tests for the new assert-file-absent.sh script. This new script introduces functionality to check for the absence of a file, but there are no accompanying behavioural or unit tests to verify its correct operation. Add tests to demonstrate and validate its behaviour. Review instructions:Path patterns: Instructions: |
||
| # Ensures the Netsuke build did not produce an unexpected artefact. | ||
| # If the artefact is present and `NINJA_MANIFEST` is set, the referenced | ||
| # Ninja manifest is dumped to stderr for debugging. | ||
| set -euo pipefail | ||
|
|
||
| if [[ $# -ne 1 ]]; then | ||
| echo "Usage: $(basename "$0") <file>" >&2 | ||
| exit 2 # usage error | ||
| fi | ||
|
|
||
| file="$1" | ||
|
|
||
| if [[ -f "$file" ]]; then | ||
| echo "Unexpected build artefact '$file' present." >&2 | ||
| if [[ -n "${NINJA_MANIFEST:-}" && -f "$NINJA_MANIFEST" ]]; then | ||
| echo "Ninja manifest '$NINJA_MANIFEST' for debugging:" >&2 | ||
| echo "-----BEGIN NINJA MANIFEST-----" >&2 | ||
| cat "$NINJA_MANIFEST" >&2 | ||
| echo "-----END NINJA MANIFEST-----" >&2 | ||
| fi | ||
|
Comment on lines
+16
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Reuse the manifest-dump helper instead of duplicating logic 🤖 Prompt for AI Agents |
||
| exit 1 | ||
| fi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| #!/usr/bin/env bash | ||
| # Ensures the Netsuke build produced the expected artefact. | ||
| # Fails fast if the given file is missing. | ||
| # If the artefact is absent and `NINJA_MANIFEST` is set, the referenced | ||
| # Ninja manifest is dumped to stderr for debugging. | ||
| set -euo pipefail | ||
|
|
||
| if [[ $# -ne 1 ]]; then | ||
|
|
@@ -12,5 +13,11 @@ file="$1" | |
|
|
||
| if [[ ! -f "$file" ]]; then | ||
| echo "Expected build artefact '$file' to exist." >&2 | ||
| if [[ -n "${NINJA_MANIFEST:-}" && -f "$NINJA_MANIFEST" ]]; then | ||
| echo "Ninja manifest '$NINJA_MANIFEST' for debugging:" >&2 | ||
| echo "-----BEGIN NINJA MANIFEST-----" >&2 | ||
| cat "$NINJA_MANIFEST" >&2 | ||
| echo "-----END NINJA MANIFEST-----" >&2 | ||
| fi | ||
|
Comment on lines
+16
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick (assertive) Extract duplicated Ninja-manifest dump into a helper to remove repetition - if [[ -n "${NINJA_MANIFEST:-}" && -f "$NINJA_MANIFEST" ]]; then
- echo "Ninja manifest '$NINJA_MANIFEST' for debugging:" >&2
- echo "-----BEGIN NINJA MANIFEST-----" >&2
- cat "$NINJA_MANIFEST" >&2
- echo "-----END NINJA MANIFEST-----" >&2
- fi
+ dump_ninja_manifest() {
+ echo "Ninja manifest '$NINJA_MANIFEST' for debugging:" >&2
+ echo "-----BEGIN NINJA MANIFEST-----" >&2
+ cat "$NINJA_MANIFEST" >&2
+ echo "-----END NINJA MANIFEST-----" >&2
+ }
+ [[ -n "${NINJA_MANIFEST:-}" && -f "$NINJA_MANIFEST" ]] && dump_ninja_manifest🤖 Prompt for AI Agents |
||
| exit 1 | ||
| fi | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick (assertive)
Remove repetitive
env: NINJA_MANIFESTblocks with YAML anchors or composite actionFour consecutive steps repeat identical
envdeclarations. Use a YAML anchor/alias or wrap the assertions in a single composite step to shrink the workflow file and keep the manifest filename in one place.Example with anchor:
🤖 Prompt for AI Agents