Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion tests/e2e/template_instantiation_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ replace_placeholder() {
}

# Replace in all text files
export TEST_REPO_NAME TEST_OWNER TEST_FORGE TEST_PROJECT_NAME \
TEST_DESCRIPTION TEST_PRIMARY_LANGUAGE TEST_AUTHOR TEST_AUTHOR_EMAIL
find "$TEST_REPO_PATH" -type f \
\( -name "*.md" -o -name "*.adoc" -o -name "*.a2ml" -o -name "*.zig" -o -name "*.idr" \
-o -name "Justfile" -o -name "Containerfile" -o -name "*.yml" -o -name "*.yaml" \
Expand All @@ -137,7 +139,7 @@ find "$TEST_REPO_PATH" -type f \
sed -i "s|$placeholder|$value|g" "$file"
fi
done
' _ "$file"
' _ {} \;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 MEDIUM RISK

Suggestion: The fix to the find command ensures the subshell executes, but the placeholder replacement may still fail for two reasons:

  1. Variable Scoping: The variables like TEST_OWNER and TEST_AUTHOR_EMAIL are local to this script. To make them visible to the sh -c subshell, they must be exported.
  2. Positional Parameters: Ensure the script inside sh -c assigns $1 (which receives the {} filename) to the file variable used in the replacement logic.

Try running the following prompt in your IDE agent:

Export the configuration variables (TEST_OWNER, TEST_FORGE, TEST_AUTHOR_EMAIL, TEST_DESCRIPTION, TEST_PRIMARY_LANGUAGE) and ensure the find -exec subshell script maps the positional parameter $1 to the variable file used in the sed commands.

See Issue in Codacy
See Issue in Codacy
See Issue in Codacy
See Issue in Codacy
See Issue in Codacy


log_pass "All placeholder tokens replaced"

Expand Down
Loading