How to get a brief summary of the pylint error messages or get the number of pylint errors, warnings, refactors using python code?
pylint -rn
This allows us to get pylint output with just messages and excludes the reports. what i have tried till now is :
lint_arg = "pylint -rn %s"%file_name
pr = subprocess.Popen(
arg, cwd=os.path.dirname(lint_path),
shell=True, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
(out, error) = pr.communicate()
pylint_result = out + "\n" + error
file=open("pylint_output",w)
file.write(pylint_result)
file.close()
I would like to get just the number of lines in which errors, warnings occurred and move this information into a string. My idea is below:
step 1 : run a pylint in python script using subprocess.Popen()
step 2 : store the output in a file or variable .
step 3: parse the file and generate the expected output as below:
Expected output : The following file < filename> has :
5 warnings in line number : 11, 34 ,56 (lines in which warnings occurred)
2 errors in line number :2 (lines in which errors occurred).
How can i do this with help of pylint command s or with the use of python script? Any help appreciated. advance thanks.