MCPcopy Create free account
hub / github.com/conda/constructor / run_shellcheck

Function run_shellcheck

tests/test_header.py:25–39  ·  view source on GitHub ↗
(script)

Source from the content-addressed store, hash-verified

23
24
25def 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")

Callers 2

test_template_shellcheckFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected