| Conditions | 2 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| 1 | from restructuredtext_lint import lint |
||
| 9 | def run(self, filename, file): |
||
| 10 | """ |
||
| 11 | Lints reStructuredText. |
||
| 12 | """ |
||
| 13 | content = ''.join(file) |
||
| 14 | errors = lint(content) |
||
| 15 | |||
| 16 | for error in errors: |
||
| 17 | severity = { |
||
| 18 | 1: RESULT_SEVERITY.INFO, |
||
| 19 | 2: RESULT_SEVERITY.NORMAL, |
||
| 20 | 3: RESULT_SEVERITY.MAJOR, |
||
| 21 | 4: RESULT_SEVERITY.MAJOR}.get(error.level, |
||
| 22 | RESULT_SEVERITY.NORMAL) |
||
| 23 | yield Result.from_values( |
||
| 24 | self, |
||
| 25 | error.message, |
||
| 26 | file=filename, |
||
| 27 | line=error.line, |
||
| 28 | debug_msg=error.full_message, |
||
| 29 | severity=severity) |
||
| 30 |