60 select = "" |
60 select = "" |
61 ignore = "" |
61 ignore = "" |
62 filename = "" |
62 filename = "" |
63 max_line_length = 79 |
63 max_line_length = 79 |
64 hang_closing = False |
64 hang_closing = False |
|
65 docType = "pep257" |
65 |
66 |
66 if "-f" not in sys.argv: |
67 if "-f" not in sys.argv: |
67 print "ERROR" |
68 print "ERROR" |
68 print "" |
69 print "" |
69 print "No file name given." |
70 print "No file name given." |
70 else: |
71 else: |
71 try: |
72 try: |
72 optlist, args = getopt.getopt(sys.argv[1:], "f:hi:m:rs:") |
73 optlist, args = getopt.getopt(sys.argv[1:], "d:f:hi:m:rs:") |
73 except getopt.GetoptError: |
74 except getopt.GetoptError: |
74 print "ERROR" |
75 print "ERROR" |
75 print "" |
76 print "" |
76 print "Wrong arguments given" |
77 print "Wrong arguments given" |
77 sys.exit(1) |
78 sys.exit(1) |
126 ) |
130 ) |
127 report = styleGuide.check_files([filename]) |
131 report = styleGuide.check_files([filename]) |
128 |
132 |
129 # check PEP-257 |
133 # check PEP-257 |
130 pep257Checker = Pep257Checker( |
134 pep257Checker = Pep257Checker( |
131 source, file, select, ignore, [], repeat, |
135 source, filename, select, ignore, [], repeat, |
132 maxLineLength=max_line_length) |
136 maxLineLength=max_line_length, docType=docType) |
133 pep257Checker.run() |
137 pep257Checker.run() |
134 |
138 |
135 |
139 |
136 errors = report.errors + pep257Checker.errors |
140 errors = report.errors + pep257Checker.errors |
137 |
141 |
146 print code |
150 print code |
147 print len(args) |
151 print len(args) |
148 for a in args: |
152 for a in args: |
149 print a |
153 print a |
150 print "PEP8_STATISTICS" |
154 print "PEP8_STATISTICS" |
|
155 # TODO: add statistics for D |
151 for key in report.counters: |
156 for key in report.counters: |
152 if key.startswith(("E", "N", "W")): |
157 if key.startswith(("E", "N", "W")): |
153 print key, report.counters[key] |
158 print key, report.counters[key] |
154 else: |
159 else: |
155 print "NO_PEP8" |
160 print "NO_PEP8" |