blob: 7c7ddee4b206525525542684990bc94af0822cb0 [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 Keishing3c230882022-04-29 03:20:24 -05003# Installation : pip3 install --upgrade robotframework-lint
4# Example usage: python3 -m rflint -rA robot_standards -R robot_custom_rules.py .
Joy Onyerikwu1483ce02019-06-26 14:56:36 -05005import re
Patrick Williams20f38712022-12-08 06:18:26 -06006
7from rflint.common import ERROR, SuiteRule
Joy Onyerikwu1483ce02019-06-26 14:56:36 -05008
9
10class ExtendInvalidTable(SuiteRule):
Patrick Williams20f38712022-12-08 06:18:26 -060011 r"""
Joy Onyerikwu1483ce02019-06-26 14:56:36 -050012 Extend robotframework-lint SuiteRule function for InvalidTable to allow a table section if it is
13 a section of comments. e.g "*** Comments ***"
Patrick Williams20f38712022-12-08 06:18:26 -060014 """
Joy Onyerikwu1483ce02019-06-26 14:56:36 -050015 severity = ERROR
16
17 def apply(self, suite):
18 for table in suite.tables:
Patrick Williams20f38712022-12-08 06:18:26 -060019 if not re.match(
20 r"^(settings?|metadata|(test )?cases?|(user"
21 r" )?keywords?|variables?|comments?)$",
22 table.name,
23 re.IGNORECASE,
24 ):
25 self.report(
26 suite,
27 "Unknown table name '%s'" % table.name,
28 table.linenumber,
29 )