File size: 488 Bytes
b12e4cb
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from pylint.lint import Run
from pylint.reporters.text import TextReporter
from io import StringIO

def pylint_check(file_path):
    try:
        output = StringIO()
        reporter = TextReporter(output)
        Run([file_path, '--disable=C0114,C0115,C0116,R0903,W0311,W0703,C0303,C0301', '--max-line-length=120'], reporter=reporter, exit=False)
        return output.getvalue()
    except Exception as e:
        return f"Pylint error: {str(e)}"

print(pylint_check("uploads/test.py"))