153 files.extend( |
153 files.extend( |
154 Utilities.direntries(fn, 1, '*{0}'.format(ext), 0)) |
154 Utilities.direntries(fn, 1, '*{0}'.format(ext), 0)) |
155 for ext in Preferences.getPython("PythonExtensions"): |
155 for ext in Preferences.getPython("PythonExtensions"): |
156 files.extend( |
156 files.extend( |
157 Utilities.direntries(fn, 1, '*{0}'.format(ext), 0)) |
157 Utilities.direntries(fn, 1, '*{0}'.format(ext), 0)) |
|
158 files.extend(Utilities.direntries(fn, 1, '*.js', 0)) |
158 else: |
159 else: |
159 files = [fn] |
160 files = [fn] |
160 |
161 |
161 self.__clearErrors(files) |
162 self.__clearErrors(files) |
162 |
163 |
164 if f.endswith( |
165 if f.endswith( |
165 tuple(Preferences.getPython("Python3Extensions")))] |
166 tuple(Preferences.getPython("Python3Extensions")))] |
166 py2files = [f for f in files |
167 py2files = [f for f in files |
167 if f.endswith( |
168 if f.endswith( |
168 tuple(Preferences.getPython("PythonExtensions")))] |
169 tuple(Preferences.getPython("PythonExtensions")))] |
|
170 jsfiles = [f for f in files if f.endswith(".js")] |
169 |
171 |
170 if (codestring and len(py3files) == 1) or \ |
172 if (codestring and len(py3files) == 1) or \ |
171 (codestring and len(py2files) == 1) or \ |
173 (codestring and len(py2files) == 1) or \ |
172 (not codestring and len(py3files) + len(py2files) > 0): |
174 (codestring and len(jsfiles) == 1) or \ |
173 self.checkProgress.setMaximum(len(py3files) + len(py2files)) |
175 (not codestring and |
|
176 len(py3files) + len(py2files) + len(jsfiles) > 0): |
|
177 self.checkProgress.setMaximum( |
|
178 len(py3files) + len(py2files) + len(jsfiles)) |
174 self.checkProgressLabel.setVisible( |
179 self.checkProgressLabel.setVisible( |
175 len(py3files) + len(py2files) > 1) |
180 len(py3files) + len(py2files) + len(jsfiles) > 1) |
176 self.checkProgress.setVisible( |
181 self.checkProgress.setVisible( |
177 len(py3files) + len(py2files) > 1) |
182 len(py3files) + len(py2files) + len(jsfiles) > 1) |
178 QApplication.processEvents() |
183 QApplication.processEvents() |
179 |
184 |
180 ignoreStarImportWarnings = \ |
185 ignoreStarImportWarnings = \ |
181 Preferences.getFlakes("IgnoreStarImportWarnings") |
186 Preferences.getFlakes("IgnoreStarImportWarnings") |
182 |
187 |
183 # now go through all the files |
188 # now go through all the files |
184 progress = 0 |
189 progress = 0 |
185 for file in py3files + py2files: |
190 for file in py3files + py2files + jsfiles: |
186 self.checkProgress.setValue(progress) |
191 self.checkProgress.setValue(progress) |
187 self.checkProgressLabel.setPath(file) |
192 self.checkProgressLabel.setPath(file) |
188 QApplication.processEvents() |
193 QApplication.processEvents() |
189 self.__resort() |
194 self.__resort() |
190 |
195 |
224 nok, fname, line, index, code, error, warnings = \ |
229 nok, fname, line, index, code, error, warnings = \ |
225 Utilities.py2compile( |
230 Utilities.py2compile( |
226 file, |
231 file, |
227 checkFlakes=Preferences.getFlakes( |
232 checkFlakes=Preferences.getFlakes( |
228 "IncludeInSyntaxCheck")) |
233 "IncludeInSyntaxCheck")) |
|
234 elif file in jsfiles: |
|
235 nok, fname, line, error = \ |
|
236 Utilities.jsCheckSyntax(file, source) |
|
237 index = 0 |
|
238 code = source[line - 1] |
229 else: |
239 else: |
230 isPy3 = True |
240 isPy3 = True |
231 nok, fname, line, index, code, error = \ |
241 nok, fname, line, index, code, error = \ |
232 Utilities.compile(file, source) |
242 Utilities.compile(file, source) |
233 if nok: |
243 if nok: |
234 self.noResults = False |
244 self.noResults = False |
235 self.__createResultItem(fname, line, index, error, code) |
245 self.__createResultItem(fname, line, index, error, code) |
236 else: |
246 else: |
237 if Preferences.getFlakes("IncludeInSyntaxCheck"): |
247 if file not in jsfiles and \ |
|
248 Preferences.getFlakes("IncludeInSyntaxCheck"): |
238 if isPy3: |
249 if isPy3: |
239 try: |
250 try: |
240 from Utilities.pyflakes.checker import Checker |
251 from Utilities.pyflakes.checker import Checker |
241 from Utilities.pyflakes.messages import \ |
252 from Utilities.pyflakes.messages import \ |
242 ImportStarUsed |
253 ImportStarUsed |