381 .replace('"""', "") |
381 .replace('"""', "") |
382 .replace("r'''", "", 1) |
382 .replace("r'''", "", 1) |
383 .replace("u'''", "", 1) |
383 .replace("u'''", "", 1) |
384 .replace("'''", "") |
384 .replace("'''", "") |
385 .strip()) |
385 .strip()) |
386 if len(lines) > 1: |
386 line1 = ( |
387 line1 = lines[1].strip().replace('"""', "").replace("'''", "") |
387 lines[1].strip().replace('"""', "").replace("'''", "") |
388 else: |
388 if len(lines) > 1 else |
389 line1 = "" |
389 "" |
390 if len(lines) > 2: |
390 ) |
391 line2 = lines[2].strip().replace('"""', "").replace("'''", "") |
391 line2 = ( |
392 else: |
392 lines[2].strip().replace('"""', "").replace("'''", "") |
393 line2 = "" |
393 if len(lines) > 2 else |
|
394 "" |
|
395 ) |
394 if line0: |
396 if line0: |
395 lineno = 0 |
397 lineno = 0 |
396 summaries.append(line0) |
398 summaries.append(line0) |
397 if not line0.endswith(".") and line1: |
399 if not line0.endswith(".") and line1: |
398 # two line summary |
400 # two line summary |
791 nonEmptyLines = [line.rstrip() for line in lines[1:] if line.strip()] |
793 nonEmptyLines = [line.rstrip() for line in lines[1:] if line.strip()] |
792 if not nonEmptyLines: |
794 if not nonEmptyLines: |
793 return |
795 return |
794 |
796 |
795 indent = min(len(line) - len(line.strip()) for line in nonEmptyLines) |
797 indent = min(len(line) - len(line.strip()) for line in nonEmptyLines) |
796 if context.contextType() == "module": |
798 expectedIndent = ( |
797 expectedIndent = 0 |
799 0 |
798 else: |
800 if context.contextType() == "module" else |
799 expectedIndent = len(context.indent()) + 4 |
801 len(context.indent()) + 4 |
|
802 ) |
800 if indent != expectedIndent: |
803 if indent != expectedIndent: |
801 self.__error(docstringContext.start(), 0, "D122") |
804 self.__error(docstringContext.start(), 0, "D122") |
802 |
805 |
803 def __checkSummary(self, docstringContext, context): |
806 def __checkSummary(self, docstringContext, context): |
804 """ |
807 """ |