Skip to content

Commit

Permalink
feat: parameterize the command's maximum allowed length (RC009) (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
EricRibeiro authored Oct 6, 2022
1 parent 00399c4 commit 88b2ba8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/jobs/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ parameters:
type: enum
enum: ["small", "medium", "medium+", "large", "xlarge", "2xlarge", "2xlarge+"]
default: "medium"
max_command_length:
description: |
The maximum length of a command (RC009).
This is used to check for commands that are too long.
Commands longer than this will fail the review.
type: integer
default: 64

docker:
- image: cimg/base:current
Expand All @@ -31,6 +38,7 @@ steps:
name: Review Best Practices
environment:
PARAM_RC_EXCLUDE: <<parameters.exclude>>
PARAM_MAX_COMMAND_LENGTH: <<parameters.exclude>>
ORB_REVIEW_BATS_FILE: <<include(scripts/review.bats)>>
ORB_PARAM_SOURCE_DIR: << parameters.source-dir >>
command: <<include(scripts/review.sh)>>
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/review.bats
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ setup() {
echo "$ORB_COMPONENT_STEP"
echo ---
ERROR_COUNT=$((ERROR_COUNT + 1))
elif [[ "${#ORB_COMPONENT_STEP_COMMAND}" -gt 64 ]]; then
elif [[ "${#ORB_COMPONENT_STEP_COMMAND}" -gt "${PARAM_MAX_COMMAND_LENGTH}" ]]; then
if [[ ! "$ORB_COMPONENT_STEP_COMMAND" =~ \<\<include\(* ]]; then
echo "File: \"${i}\""
echo "Line number: ${ORB_COMPONENT_LINE_NUMBER}"
Expand Down

0 comments on commit 88b2ba8

Please sign in to comment.