Skip to content
This repository was archived by the owner on Oct 28, 2024. It is now read-only.

fix: support using gherkin-lint args #723

Merged
merged 2 commits into from
Sep 15, 2020
Merged
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
34 changes: 30 additions & 4 deletions .ci/scripts/gherkin-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,37 @@ set -eo pipefail
IMAGE="gherkin/lint"
docker pull "${IMAGE}" > /dev/null || true

## Iterate for each file without failing fast.
arguments=""
declare -a files

set +e
for file in "$@"; do
if ! docker run --rm -t -v "$(pwd)":/src -w /src "${IMAGE}" ${file} ; then
echo "ERROR: gherkin-lint failed for the file '${file}'"

while [ "$1" != "" ]; do
case $1 in
--disable )
arguments="$arguments $1 $2"
shift
;;
--enable )
arguments="$arguments $1 $2"
shift
;;
-v | --verbose )
arguments="$arguments $1"
;;
* )
files+=("$1")
esac
shift
done

echo "Running gherkin-lint with arguments: '${arguments}'"

## Iterate for each file without failing fast.
for file in "${files[@]}"; do
# shellcheck disable=SC2086
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm disabling double-quoting the ${arguments} and ${file} variables because otherwise they won't be passed to the docker container properly.

if ! docker run --rm -t -v "$(pwd)":/src -w /src "${IMAGE}" ${arguments} ${file}; then
echo "ERROR: gherkin-lint failed for the file '${file}'. Arguments: ${arguments}"
exit_status=1
fi
done
Expand Down