Tue, 14 Apr 2015 19:51:10 +0200
Fixed two little issue that could lead to a traceback in the code style checker dialog and Utilities.
Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py | file | annotate | diff | comparison | revisions | |
Utilities/__init__.py | file | annotate | diff | comparison | revisions |
--- a/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Sun Apr 12 18:00:45 2015 +0200 +++ b/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleCheckerDialog.py Tue Apr 14 19:51:10 2015 +0200 @@ -394,16 +394,13 @@ self.__lastFileItem = None if codestring: - self.source = codestring + source = codestring + encoding = Utilities.get_coding(source) else: try: - self.source, encoding = Utilities.readEncodedFile( + source, encoding = Utilities.readEncodedFile( self.filename) - if encoding.endswith( - ('-selected', '-default', '-guessed', '-ignore')): - encoding = encoding.rsplit('-', 1)[0] - - self.source = self.source.splitlines(True) + source = source.splitlines(True) except (UnicodeError, IOError) as msg: self.noResults = False self.__createResultItem( @@ -414,6 +411,9 @@ # Continue with next file self.check() return + if encoding.endswith( + ('-selected', '-default', '-guessed', '-ignore')): + encoding = encoding.rsplit('-', 1)[0] errors = [] self.__itms = [] @@ -426,7 +426,7 @@ errors, eol, encoding, Preferences.getEditor("CreateBackupFile") ] self.styleCheckService.styleCheck( - None, self.filename, self.source, args) + None, self.filename, source, args) def __processResult(self, fn, codeStyleCheckerStats, fixes, results): """
--- a/Utilities/__init__.py Sun Apr 12 18:00:45 2015 +0200 +++ b/Utilities/__init__.py Tue Apr 14 19:51:10 2015 +0200 @@ -1427,6 +1427,8 @@ pyVer = 0 if filename: + if not source: + source = readEncodedFile(filename)[0] flags = extractFlags(source) ext = os.path.splitext(filename)[1] py2Ext = Preferences.getPython("PythonExtensions")