eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py

changeset 8221
0572a215bd2f
parent 8217
385f60c94548
child 8240
93b8a353c4bf
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py	Sun Apr 11 12:38:16 2021 +0200
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/CodeStyleFixer.py	Sun Apr 11 16:53:48 2021 +0200
@@ -252,16 +252,16 @@
             """
             return b.startswith(a) or a.startswith(b)
         
-        if self.__noFixCodes:
-            for noFixCode in [c.strip() for c in self.__noFixCodes]:
-                if mutualStartswith(code.lower(), noFixCode.lower()):
-                    return False
+        if (
+            self.__noFixCodes and
+            any(mutualStartswith(code.lower(), noFixCode.lower())
+                for noFixCode in [c.strip() for c in self.__noFixCodes])
+        ):
+            return False
 
         if self.__fixCodes:
-            for fixCode in [c.strip() for c in self.__fixCodes]:
-                if mutualStartswith(code.lower(), fixCode.lower()):
-                    return True
-            return False
+            return any(mutualStartswith(code.lower(), fixCode.lower())
+                       for fixCode in [c.strip() for c in self.__fixCodes])
 
         return True
     
@@ -2421,9 +2421,8 @@
 
                 if token_type == tokenize.OP and text in ']})':
                     pass
-                elif visual_indent is True:
-                    if not indent[depth]:
-                        indent[depth] = start[1]
+                elif visual_indent is True and not indent[depth]:
+                    indent[depth] = start[1]
 
             # line altered: comments shouldn't define a visual indent
             if parens[row] and not indent[depth] and token_type not in (
@@ -2884,10 +2883,12 @@
                 '[': ']',
                 '{': '}'}.get(lines[0][-1], None)
 
-            if len(lines) > 1:
-                if (badStartingSymbol and
-                        lines[1].lstrip().startswith(badStartingSymbol)):
-                    rank += 20
+            if (
+                len(lines) > 1 and
+                badStartingSymbol and
+                lines[1].lstrip().startswith(badStartingSymbol)
+            ):
+                rank += 20
 
             if re.match(r".*[+\-\*/] \($", lines[0]):
                 # "1 * (\n" is ugly as hell.

eric ide

mercurial