3 ms·
Fun fact, not only that, since their support for "embedded languages" is second to none: import re if re.match(r'[aoeui', sys.argv[1]): print('
by mdaniel 3y ago
Fun fact, not only that, since their support for "embedded languages" is second to none:
import re
if re.match(r'[aoeui', sys.argv[1]):
print('ok!')
is a red error in the ide because it understands regex syntax, and similar if it can either prove what the syntax is (based on its position, as seen in that re.match), or in all cases one can annotate the string literal to have it help you:
# language=json
not_json = """
{"oops:true}
"""
json.loads(not_json)
is similarly marked as red because that's not json
it's turtles all the way down:
# language=yaml
gitlab_yaml = """
stages:
- build
my build:
image: docker.io/library/busybox
after_cript:
# language=sh
- |
if true; then
echo "awesome"
fi
"""
spots the suspicious "after_cript" (in yellow, because it cannot prove it's wrong, just suspicious) and then it also highlights the embedded shell script in the embedded yaml string literal
Regrettably, it doesn't seem to run the shell validity checks on injected shell scripts, but I think that's a bug and not a limitation of the platform