Pylint warning and error fix in script
Changes:
- C0114: Missing module docstring
- C0116: Missing function or method docstring
- C0209: Formatting a regular string which could be a f-string
Tested:
- python3 -m pylint tools/robot_custom_rules.py
Change-Id: I6262db7919f3d64fd2012b2bdf8c2f0943f7f522
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/tools/robot_custom_rules.py b/tools/robot_custom_rules.py
index 7c7ddee..2b1c14c 100755
--- a/tools/robot_custom_rules.py
+++ b/tools/robot_custom_rules.py
@@ -1,7 +1,11 @@
#!/usr/bin/env python3
-# Custom rules file for robotframework-lint.
-# Installation : pip3 install --upgrade robotframework-lint
-# Example usage: python3 -m rflint -rA robot_standards -R robot_custom_rules.py .
+r"""
+Custom rules file for robotframework-lint.
+Installation : pip3 install --upgrade robotframework-lint
+Example usage:
+ python3 -m rflint -rA robot_standards -R robot_custom_rules.py .
+"""
+
import re
from rflint.common import ERROR, SuiteRule
@@ -9,12 +13,16 @@
class ExtendInvalidTable(SuiteRule):
r"""
- Extend robotframework-lint SuiteRule function for InvalidTable to allow a table section if it is
- a section of comments. e.g "*** Comments ***"
+ Extend robotframework-lint SuiteRule function for InvalidTable to allow a
+ table section if it is a section of comments.
+ e.g "*** Comments ***"
"""
severity = ERROR
def apply(self, suite):
+ r"""
+ Walk through the code and report.
+ """
for table in suite.tables:
if not re.match(
r"^(settings?|metadata|(test )?cases?|(user"
@@ -24,6 +32,6 @@
):
self.report(
suite,
- "Unknown table name '%s'" % table.name,
+ table.name,
table.linenumber,
)