eric6/Plugins/CheckerPlugins/CodeStyleChecker/DocStyle/DocStyleChecker.py

changeset 8259
2bbec88047dd
parent 8243
cc717c2ae956
child 8273
698ae46f40a4
diff -r 82b608e352ec -r 2bbec88047dd eric6/Plugins/CheckerPlugins/CodeStyleChecker/DocStyle/DocStyleChecker.py
--- a/eric6/Plugins/CheckerPlugins/CodeStyleChecker/DocStyle/DocStyleChecker.py	Wed Apr 21 17:56:12 2021 +0200
+++ b/eric6/Plugins/CheckerPlugins/CodeStyleChecker/DocStyle/DocStyleChecker.py	Wed Apr 21 19:40:50 2021 +0200
@@ -383,14 +383,16 @@
                  .replace("u'''", "", 1)
                  .replace("'''", "")
                  .strip())
-        if len(lines) > 1:
-            line1 = lines[1].strip().replace('"""', "").replace("'''", "")
-        else:
-            line1 = ""
-        if len(lines) > 2:
-            line2 = lines[2].strip().replace('"""', "").replace("'''", "")
-        else:
-            line2 = ""
+        line1 = (
+            lines[1].strip().replace('"""', "").replace("'''", "")
+            if len(lines) > 1 else
+            ""
+        )
+        line2 = (
+            lines[2].strip().replace('"""', "").replace("'''", "")
+            if len(lines) > 2 else
+            ""
+        )
         if line0:
             lineno = 0
             summaries.append(line0)
@@ -793,10 +795,11 @@
             return
         
         indent = min(len(line) - len(line.strip()) for line in nonEmptyLines)
-        if context.contextType() == "module":
-            expectedIndent = 0
-        else:
-            expectedIndent = len(context.indent()) + 4
+        expectedIndent = (
+            0
+            if context.contextType() == "module" else
+            len(context.indent()) + 4
+        )
         if indent != expectedIndent:
             self.__error(docstringContext.start(), 0, "D122")
     

eric ide

mercurial