mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
Add a code-smell test for smart quotes and remove smart quotes from all files
This commit is contained in:
parent
f9370c95d7
commit
c82cf791dd
41 changed files with 147 additions and 120 deletions
23
test/sanity/code-smell/no-smart-quotes.sh
Executable file
23
test/sanity/code-smell/no-smart-quotes.sh
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/sh
|
||||
|
||||
# shellcheck disable=SC1015,SC1016
|
||||
egrep -r '[‘’“”]' . \
|
||||
--exclude-dir .git \
|
||||
--exclude-dir .tox \
|
||||
| grep -v \
|
||||
-e './test/sanity/code-smell/no-smart-quotes.sh' \
|
||||
-e './docs/docsite/rst/dev_guide/testing/sanity/no-smart-quotes.rst' \
|
||||
-e './test/integration/targets/unicode/unicode.yml' \
|
||||
-e '\.doctree matches$' \
|
||||
-e '\.pickle matches$' \
|
||||
-e './docs/docsite/_build/html/'
|
||||
|
||||
if [ $? -ne 1 ]; then
|
||||
printf 'The file(s) listed above have non-ascii quotes.\n'
|
||||
# shellcheck disable=SC1015,SC1016
|
||||
printf 'Make sure all files use " and '"'"' as quotation marks\n'
|
||||
printf 'These sed commands may be of help to you:\n'
|
||||
# shellcheck disable=SC1015,SC1016
|
||||
printf " sed 's/[”“]/\"/g' \$FILENAME -i && sed \"s/[‘’]/'/g\" \$FILENAME -i\\n"
|
||||
exit 1
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue