File size: 558 Bytes
e3b5d4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import subprocess
import tempfile

def run_pylint(code):
    with tempfile.NamedTemporaryFile(suffix=".py", delete=False) as f:
        f.write(code.encode())
        f.flush()
        result = subprocess.run(["pylint", f.name], capture_output=True, text=True)
    return result.stdout

def run_bandit(code):
    with tempfile.NamedTemporaryFile(suffix=".py", delete=False) as f:
        f.write(code.encode())
        f.flush()
        result = subprocess.run(["bandit", "-r", f.name], capture_output=True, text=True)
    return result.stdout