- result = subprocess.run(
- ["flake8", "."],
- encoding="utf-8",
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- )
+ output = io.StringIO()
+ with contextlib.redirect_stdout(output), contextlib.redirect_stderr(output):
+ app = Application()
+ app.run(["ice_validator"])
+ output.seek(0)
+ lines = [f" {l}" for l in output.readlines()]
+ return ["flake8 errors detected:"] + lines if lines else []
+
+
+def check_bandit_passes():
+ result = subprocess.run( # nosec
+ ["bandit", "-c", "bandit.yaml", "-r", ".", "-x", "./.tox/**"], # nosec
+ encoding="utf-8", # nosec
+ stdout=subprocess.PIPE, # nosec
+ stderr=subprocess.PIPE, # nosec
+ ) # nosec