mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 22:00:22 -07:00
Remove use of unicode_literals as it is an anti-pattern
from __future__ unicode_literals leads to developer confusion as developers no longer can tell whether a bare literal string is a byte string or a unicode string. Explicit marking as u"" or b"" is the way to solve the same problem in the Ansbile codebase.
This commit is contained in:
parent
362a2e523a
commit
ff13d58c14
3 changed files with 50 additions and 19 deletions
16
test/sanity/code-smell/no-unicode-literals.sh
Executable file
16
test/sanity/code-smell/no-unicode-literals.sh
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/bin/sh
|
||||
|
||||
UNICODE_LITERALS_USERS=$(grep -r unicode_literals . \
|
||||
--exclude-dir .git \
|
||||
--exclude-dir .tox \
|
||||
--exclude no-unicode-literals.sh \
|
||||
--exclude no-unicode-literals.rst |
|
||||
grep -v ./test/results \
|
||||
)
|
||||
|
||||
if [ "${UNICODE_LITERALS_USERS}" ]; then
|
||||
echo "${UNICODE_LITERALS_USERS}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue