Plugins/CheckerPlugins/Pep8/Pep8Checker.py

changeset 2929
28ab0bc63d69
parent 2917
fe82710d02cb
child 2971
efd4a4343019
child 3056
9986ec0e559a
equal deleted inserted replaced
2928:4f74d3f595ce 2929:28ab0bc63d69
25 """ 25 """
26 Class implementing the PEP 8 checker interface for Python 2. 26 Class implementing the PEP 8 checker interface for Python 2.
27 """ 27 """
28 def __init__(self, filename, lines, repeat=False, 28 def __init__(self, filename, lines, repeat=False,
29 select="", ignore="", max_line_length=79, 29 select="", ignore="", max_line_length=79,
30 hang_closing=False): 30 hang_closing=False, docType="pep257"):
31 """ 31 """
32 Constructor 32 Constructor
33 33
34 @param filename name of the file to check (string) 34 @param filename name of the file to check (string)
35 @param lines source of the file (list of strings) (ignored) 35 @param lines source of the file (list of strings) (ignored)
39 @keyparam ignore list of message IDs to ignore 39 @keyparam ignore list of message IDs to ignore
40 (comma separated string) 40 (comma separated string)
41 @keyparam max_line_length maximum allowed line length (integer) 41 @keyparam max_line_length maximum allowed line length (integer)
42 @keyparam hang_closing flag indicating to allow hanging closing 42 @keyparam hang_closing flag indicating to allow hanging closing
43 brackets (boolean) 43 brackets (boolean)
44 @keyparam docType type of the documentation strings
45 (string, one of 'eric' or 'pep257')
44 """ 46 """
47 assert docType in ("eric", "pep257")
48
45 self.errors = [] 49 self.errors = []
46 self.counters = {} 50 self.counters = {}
47 51
48 interpreter = Preferences.getDebugger("PythonInterpreter") 52 interpreter = Preferences.getDebugger("PythonInterpreter")
49 if interpreter == "" or not Utilities.isExecutable(interpreter): 53 if interpreter == "" or not Utilities.isExecutable(interpreter):
66 args.append(ignore) 70 args.append(ignore)
67 args.append("-m") 71 args.append("-m")
68 args.append(str(max_line_length)) 72 args.append(str(max_line_length))
69 if hang_closing: 73 if hang_closing:
70 args.append("-h") 74 args.append("-h")
75 args.append("-d")
76 args.append(docType)
71 args.append("-f") 77 args.append("-f")
72 args.append(filename) 78 args.append(filename)
73 79
74 proc = QProcess() 80 proc = QProcess()
75 proc.setProcessChannelMode(QProcess.MergedChannels) 81 proc.setProcessChannelMode(QProcess.MergedChannels)

eric ide

mercurial