(script)
| 23 | |
| 24 | |
| 25 | def run_shellcheck(script): |
| 26 | with tempfile.NamedTemporaryFile(mode="w", suffix=".sh") as f: |
| 27 | f.write(script) |
| 28 | f.flush() |
| 29 | |
| 30 | cmd = [ |
| 31 | "shellcheck", |
| 32 | # https://www.shellcheck.net/wiki/SC2034 |
| 33 | "--exclude=SC2034", |
| 34 | f"{f.name}", |
| 35 | ] |
| 36 | p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True) |
| 37 | sc_stdout, _ = p.communicate() |
| 38 | findings = sc_stdout.splitlines() |
| 39 | return findings, p.returncode |
| 40 | |
| 41 | |
| 42 | @pytest.mark.skipif(sys.platform != "darwin", reason="Only on MacOS") |
no outgoing calls
no test coverage detected