Let's say I have a python function and dictionary as follows:
d = {"a": 1, "b": 2, "c": 3}
def foo(input):
return d[input]
Is there a way when I push my code to GitHub (presumably with some sort of continuous integration) to check that all calls of foo
only use one of the keys of d
as the input
argument, and if there is a call with an invalid argument, to flag it or raise an alert?
For example:
foo("a") # no flag
foo("d") # flag/alert
I know how I would raise an exception or ValueError
at runtime, but I'm looking for a CI solution to include in our GitHub workflow. Right now we are using Travis-CI for our custom tests and the standard CodeQL tests provided by LGTM. I looked into using custom CodeQL via LGTM, but I couldn't quite figure it out. I'd be fine implementing it in either of those continuous integrations or implementing a third.