blob: ef10c846d93c2398ed8b84cf4db75a61eb435b2a [file] [log] [blame]
George Keishinge7e91712021-09-03 11:28:44 -05001#!/usr/bin/env python3
Joy Onyerikwu1483ce02019-06-26 14:56:36 -05002# Custom rules file for robotframework-lint.
George Keishing4b5f05b2020-02-19 01:32:45 -06003# Example usage: python -m rflint -rA robot_standards -R robot_custom_rules.py .
Joy Onyerikwu1483ce02019-06-26 14:56:36 -05004import re
5from rflint.common import SuiteRule, ERROR
6
7
8class 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)