Skip to content

Commit

Permalink
feat: RC010 snake_case
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleTryon committed Apr 10, 2023
1 parent 951b6a7 commit 29284d8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/scripts/review.bats
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,29 @@ setup() {
exit 1
fi
}

@test "RC010: All components (jobs, commands, executors, examples) should be snake_cased." {
if [[ "${SKIPPED_REVIEW_CHECKS[*]}" =~ "RC010" ]]; then
skip
fi
for i in $(find "${ORB_SOURCE_DIR}jobs" "${ORB_SOURCE_DIR}commands" "${ORB_SOURCE_DIR}executors" -name "*.yml" 2>/dev/null); do
# Check file name for snake_case
ORB_COMPONENT_FILE_NAME=$(basename "$i")
if [[ "$ORB_COMPONENT_FILE_NAME" == *"-"* ]]; then
echo "File: \"${i}\""
echo "Component names should be snake_cased. Please rename this file to use snake_case."
exit 1
fi
# Check parameter keys on component for snake_case
ORB_COMPONENT_PARAMETERS_COUNT=$(yq '.parameters | keys | .[]' "$i")
for j in $ORB_COMPONENT_PARAMETERS_COUNT; do
if [[ "$j" == *"-"* ]]; then
echo "File: \"${i}\""
echo " Parameter: \"${j}\""
echo "Parameter keys should be snake_cased. Please rename this parameter to use snake_case."
exit 1
fi
done

done
}

0 comments on commit 29284d8

Please sign in to comment.