Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Solves Issue #321: Check for space separated keywords #323

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions schlib/rules/S6_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions schlib/rules/rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import sys
import os
import re

common = os.path.abspath(os.path.join(sys.path[0], '..', 'common'))

Expand Down