forked from loafle/openapi-generator-original
Add monitoring to detect tabs in the templates (#8738)
* add monitoring for tabs in the templates * rename script * add detect_tab_in_templates.sh * rearrange tests * add kotlin folders * move test to circleci * restore .travis.yml * fix grep
This commit is contained in:
parent
4bf09833f4
commit
9c4c624eb7
@ -149,6 +149,8 @@ install:
|
|||||||
script:
|
script:
|
||||||
# fail fast
|
# fail fast
|
||||||
- set -e
|
- set -e
|
||||||
|
# fail if the template files contains tabs
|
||||||
|
- /bin/bash ./bin/utils/detect_tab_in_templates.sh
|
||||||
# fail if the test files have changes
|
# fail if the test files have changes
|
||||||
- bin/utils/detect_test_file_changes.rb bin/utils/test_file_list.yaml
|
- bin/utils/detect_test_file_changes.rb bin/utils/test_file_list.yaml
|
||||||
# fail if templates/generators contain carriage return '\r'
|
# fail if templates/generators contain carriage return '\r'
|
||||||
|
28
bin/utils/detect_tab_in_templates.sh
Executable file
28
bin/utils/detect_tab_in_templates.sh
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Look for \t in the template folders and report errors if found
|
||||||
|
# as these tabs should be replaced with 4-space instead
|
||||||
|
|
||||||
|
## declare an array of folders
|
||||||
|
declare -a samples=("modules/openapi-generator/src/main/resources/kotlin-server"
|
||||||
|
"modules/openapi-generator/src/main/resources/kotlin-spring"
|
||||||
|
"modules/openapi-generator/src/main/resources/dart-dio"
|
||||||
|
"modules/openapi-generator/src/main/resources/dart"
|
||||||
|
"modules/openapi-generator/src/main/resources/dart2"
|
||||||
|
"modules/openapi-generator/src/main/resources/aspnetcore"
|
||||||
|
"modules/openapi-generator/src/main/resources/powershell"
|
||||||
|
)
|
||||||
|
|
||||||
|
## now loop through the above array
|
||||||
|
for i in "${samples[@]}"
|
||||||
|
do
|
||||||
|
# grep for \t in the folder
|
||||||
|
RESULT=`grep -R -P "\t" $i`
|
||||||
|
echo -e "$RESULT"
|
||||||
|
|
||||||
|
if [ "$RESULT" != "" ]; then
|
||||||
|
echo "Template files contain tab '\\t'. Please remove it or replace it with 4-space."
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user