Skip to content

Commit

Permalink
Schlib: Check for space separated keywords
Browse files Browse the repository at this point in the history
Check if the keywords contain 'evil' characters. We don't want commas or
dots but spaces instead. Try to handle special cases like '3.3V' where a
dot is allowed.

Resolves: KiCad#321
  • Loading branch information
cpresser authored and chschlue committed Nov 12, 2020
1 parent f74f2a0 commit 2da0dd6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions schlib/rules/S6_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ def checkKeywords(self):
else:
self.error("Missing Keywords field on 'Properties' tab")
return True
else:
# find special chars.
# a dot followed by a non-word char is also considered a violation. This allows 3.3V but prevents 'foobar. buzz'
forbidden_matches = re.findall('\.\W|\.$|[,:;?!<>]', keywords)
if forbidden_matches:
errors.append("Symbol keywords contain forbidden symbols: {}".format(forbidden_matches))
return True

return False

Expand Down

0 comments on commit 2da0dd6

Please sign in to comment.