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

Allow checking multiple specific components using CSV #297

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 8 additions & 3 deletions schlib/checklib.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

parser = argparse.ArgumentParser(description='Checks KiCad library files (.lib) against KiCad Library Convention (KLC) rules. You can find the KLC at http://kicad-pcb.org/libraries/klc/')
parser.add_argument('libfiles', nargs='+')
parser.add_argument('-c', '--component', help='check only a specific component (implicitly verbose)', action='store')
parser.add_argument('-c', '--component', help='Check only one or more specific component(s) (implicitly verbose). Use comma separated values to select multiple components', action='store')
parser.add_argument('-p', '--pattern', help='Check multiple components by matching a regular expression', action='store')
parser.add_argument('-r','--rule',help='Select a particular rule (or rules) to check against (default = all rules). Use comma separated values to select multiple rules. e.g. "-r 3.1,EC02"')
parser.add_argument('-e','--exclude',help='Exclude a particular rule (or rules) to check against. Use comma separated values to select multiple rules. e.g. "-e 3.1,EC02"')
Expand Down Expand Up @@ -57,6 +57,11 @@
else:
excluded_rules = None

if args.component:
components = args.component.lower().split(',')
else:
components = None

rules = []

for r in all_rules:
Expand Down Expand Up @@ -105,8 +110,8 @@

#simple match
match = True
if args.component:
match = match and args.component.lower() == component.name.lower()
if components:
match = match and component.name.lower() in components

#regular expression match
if args.pattern:
Expand Down