George Keishing | e7e9171 | 2021-09-03 11:28:44 -0500 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Joy Onyerikwu | 1483ce0 | 2019-06-26 14:56:36 -0500 | [diff] [blame] | 2 | # Custom rules file for robotframework-lint. |
George Keishing | 4b5f05b | 2020-02-19 01:32:45 -0600 | [diff] [blame] | 3 | # Example usage: python -m rflint -rA robot_standards -R robot_custom_rules.py . |
Joy Onyerikwu | 1483ce0 | 2019-06-26 14:56:36 -0500 | [diff] [blame] | 4 | import re |
| 5 | from rflint.common import SuiteRule, ERROR |
| 6 | |
| 7 | |
| 8 | class ExtendInvalidTable(SuiteRule): |
| 9 | r''' |
| 10 | Extend robotframework-lint SuiteRule function for InvalidTable to allow a table section if it is |
| 11 | a section of comments. e.g "*** Comments ***" |
| 12 | ''' |
| 13 | severity = ERROR |
| 14 | |
| 15 | def apply(self, suite): |
| 16 | for table in suite.tables: |
| 17 | if (not re.match(r'^(settings?|metadata|(test )?cases?|(user )?keywords?|variables?|comments?)$', |
| 18 | table.name, re.IGNORECASE)): |
| 19 | self.report(suite, "Unknown table name '%s'" % table.name, table.linenumber) |