diff --git a/schlib/rules/S6_3.py b/schlib/rules/S6_3.py index 995f4688..db52bb1e 100644 --- a/schlib/rules/S6_3.py +++ b/schlib/rules/S6_3.py @@ -74,6 +74,17 @@ def checkDocumentation(self, name, documentation, alias=False, isGraphicOrPowerS if not link: warnings.append("Datasheet entry '{ds}' does not look like a URL".format(ds=ds)) + # Handle keyword seperator. Right now it filters based on a regular + # expression based on certain symbols. Right now hyphen (-) is still allowed. + try: + keywords = documentation.get('keywords', '') + forbidden_matches = re.findall('[,.:;?!<>]', keywords) + if forbidden_matches: + errors.append("Symbol keywords contain forbidden symbols: {}".format(forbidden_matches)) + except: + warnings.append("Symbol appears to not have any keywords.") + + if len(errors) > 0 or len(warnings) > 0: msg = "{cmp} {name} has metadata errors:".format( cmp="ALIAS" if alias else "Component", diff --git a/schlib/rules/rule.py b/schlib/rules/rule.py index ad1d12c3..307e3564 100644 --- a/schlib/rules/rule.py +++ b/schlib/rules/rule.py @@ -2,6 +2,7 @@ import sys import os +import re common = os.path.abspath(os.path.join(sys.path[0], '..', 'common'))