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 | 3c23088 | 2022-04-29 03:20:24 -0500 | [diff] [blame] | 3 | # Installation : pip3 install --upgrade robotframework-lint |
| 4 | # Example usage: python3 -m rflint -rA robot_standards -R robot_custom_rules.py . |
Joy Onyerikwu | 1483ce0 | 2019-06-26 14:56:36 -0500 | [diff] [blame] | 5 | import re |
| 6 | from rflint.common import SuiteRule, ERROR |
| 7 | |
| 8 | |
| 9 | class ExtendInvalidTable(SuiteRule): |
| 10 | r''' |
| 11 | Extend robotframework-lint SuiteRule function for InvalidTable to allow a table section if it is |
| 12 | a section of comments. e.g "*** Comments ***" |
| 13 | ''' |
| 14 | severity = ERROR |
| 15 | |
| 16 | def apply(self, suite): |
| 17 | for table in suite.tables: |
| 18 | if (not re.match(r'^(settings?|metadata|(test )?cases?|(user )?keywords?|variables?|comments?)$', |
| 19 | table.name, re.IGNORECASE)): |
| 20 | self.report(suite, "Unknown table name '%s'" % table.name, table.linenumber) |