Skip to content

Commit 4bf3cd8

Browse files
committed
Change casing, fix shellcheck disables, add .shekkcheckrc
1 parent 9350971 commit 4bf3cd8

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

bin/generate_tests

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,15 @@ use $(dash_to_underscore "$slug")::*;
2929
EOT
3030

3131
# Flattens canonical json, extracts only the objects with a uuid
32-
cases=$(echo "$canonical_json" | jq '[ .. | objects | with_entries(select(.key | IN("uuid", "description", "input", "expected", "property"))) | select(. != {}) | select(has("uuid")) ]')
32+
CASES=$(echo "$CANONICAL_JSON" | jq '[ .. | objects | with_entries(select(.key | IN("uuid", "description", "input", "expected", "property"))) | select(. != {}) | select(has("uuid")) ]')
3333

3434
# Shellcheck doesn't recognize that `case` is not unused
3535
# shellcheck disable=SC2034
36-
jq -c '.[]' <<<"$cases" | while read -r case; do
36+
jq -c '.[]' <<<"$CASES" | while read -r case; do
3737

3838
# Evaluate the bash parts and replace them with their return values
39-
eval_template="$(digest_template | sed -e "s/\$(\(.*\))/\$\(\1\)/g")"
40-
eval_template="$(eval "echo \"$eval_template\"")"
39+
EVAL_TEMPLATE="$(digest_template | sed -e "s/\$(\(.*\))/\$\(\1\)/g")"
40+
EVAL_TEMPLATE="$(eval "echo \"$EVAL_TEMPLATE\"")"
4141

4242
# Turn function name into snake_case
4343
formatted_template=$(echo "$eval_template" | sed -e ':loop' -e 's/\(fn[^(]*\)[ -]/\1_/g' -e 't loop' | sed 's/fn_/fn /')

bin/generator-utils/templates.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ EOT
4242
else
4343
local canonical_json
4444
canonical_json=$(cat canonical_data.json)
45+
local canonical_json
4546

4647
# sometimes canonical data has multiple levels with multiple `cases` arrays.
4748
#(see kindergarten-garden https://github.com/exercism/problem-specifications/blob/main/exercises/kindergarten-garden/canonical-data.json)
@@ -114,6 +115,7 @@ create_example_rs_template() {
114115

115116
local fn_name
116117
fn_name=$(create_fn_name "$slug" "$has_canonical_data")
118+
local fn_name
117119

118120
mkdir "${exercise_dir}/.meta"
119121
cat <<EOT >"${exercise_dir}/.meta/example.rs"

0 commit comments

Comments
 (0)