869 return |
869 return |
870 |
870 |
871 if "return" not in docstringContext.ssource().lower(): |
871 if "return" not in docstringContext.ssource().lower(): |
872 tokens = list( |
872 tokens = list( |
873 tokenize.generate_tokens(StringIO(context.ssource()).readline)) |
873 tokenize.generate_tokens(StringIO(context.ssource()).readline)) |
874 return_ = [tokens[i + 1][0] for i, token in enumerate(tokens) |
874 return_ = [tokens[i + 1][0] for i, token in enumerate(tokens) |
875 if token[1] == "return"] |
875 if token[1] == "return"] |
876 if (set(return_) - |
876 if (set(return_) - |
877 set([tokenize.COMMENT, tokenize.NL, tokenize.NEWLINE]) != |
877 set([tokenize.COMMENT, tokenize.NL, tokenize.NEWLINE]) != |
878 set([])): |
878 set([])): |
879 self.__error(docstringContext.end(), 0, "D134") |
879 self.__error(docstringContext.end(), 0, "D134") |
1033 if docstringContext is None: |
1033 if docstringContext is None: |
1034 return |
1034 return |
1035 |
1035 |
1036 tokens = list( |
1036 tokens = list( |
1037 tokenize.generate_tokens(StringIO(context.ssource()).readline)) |
1037 tokenize.generate_tokens(StringIO(context.ssource()).readline)) |
1038 return_ = [tokens[i + 1][0] for i, token in enumerate(tokens) |
1038 return_ = [tokens[i + 1][0] for i, token in enumerate(tokens) |
1039 if token[1] in ("return", "yield")] |
1039 if token[1] in ("return", "yield")] |
1040 if "@return" not in docstringContext.ssource(): |
1040 if "@return" not in docstringContext.ssource(): |
1041 if (set(return_) - |
1041 if (set(return_) - |
1042 set([tokenize.COMMENT, tokenize.NL, tokenize.NEWLINE]) != |
1042 set([tokenize.COMMENT, tokenize.NL, tokenize.NEWLINE]) != |
1043 set([])): |
1043 set([])): |
1109 if docstringContext is None: |
1109 if docstringContext is None: |
1110 return |
1110 return |
1111 |
1111 |
1112 tokens = list( |
1112 tokens = list( |
1113 tokenize.generate_tokens(StringIO(context.ssource()).readline)) |
1113 tokenize.generate_tokens(StringIO(context.ssource()).readline)) |
1114 exception = [tokens[i + 1][0] for i, token in enumerate(tokens) |
1114 exception = [tokens[i + 1][0] for i, token in enumerate(tokens) |
1115 if token[1] == "raise"] |
1115 if token[1] == "raise"] |
1116 if "@exception" not in docstringContext.ssource() and \ |
1116 if "@exception" not in docstringContext.ssource() and \ |
1117 "@throws" not in docstringContext.ssource() and \ |
1117 "@throws" not in docstringContext.ssource() and \ |
1118 "@raise" not in docstringContext.ssource(): |
1118 "@raise" not in docstringContext.ssource(): |
1119 if (set(exception) - |
1119 if (set(exception) - |