one_line checks if docstring (len < 40) is on one line. Args: node (astroid.node): The node visiting. Returns: True if successful otherwise False.
(self, node)
| 216 | return True |
| 217 | |
| 218 | def one_line(self, node): |
| 219 | """one_line checks if docstring (len < 40) is on one line. |
| 220 | Args: |
| 221 | node (astroid.node): The node visiting. |
| 222 | Returns: |
| 223 | True if successful otherwise False. |
| 224 | """ |
| 225 | |
| 226 | doc = node.doc |
| 227 | if doc is None: |
| 228 | return True |
| 229 | |
| 230 | if len(doc) > 40: |
| 231 | return True |
| 232 | elif sum(doc.find(nl) for nl in ('\n', '\r', '\n\r')) == -3: |
| 233 | return True |
| 234 | else: |
| 235 | self.add_message('W9001', node=node, line=node.fromlineno) |
| 236 | return False |
| 237 | |
| 238 | return True |
| 239 | |
| 240 | def has_period(self, node): |
| 241 | """has_period checks if one line doc end-with '.' . |