diff --git a/common/rulebase.py b/common/rulebase.py index dc53bcbc..72d93ae9 100644 --- a/common/rulebase.py +++ b/common/rulebase.py @@ -108,8 +108,8 @@ def name(self): path = "".join(path.split(".")[:-1]) return path.replace('_', '.') - def __init__(self, description): - self.description = description + def __init__(self): + self.description = self.__doc__.strip().splitlines()[0].strip() self.messageBuffer=[] self.resetErrorCount() self.resetWarningCount() diff --git a/pcb/rules/F5_1.py b/pcb/rules/F5_1.py index a162c9b0..bc267851 100644 --- a/pcb/rules/F5_1.py +++ b/pcb/rules/F5_1.py @@ -7,11 +7,7 @@ import cmath class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, "Silkscreen layer requirements") + """Silkscreen layer requirements""" def checkReference(self): """ diff --git a/pcb/rules/F5_2.py b/pcb/rules/F5_2.py index da37094f..8daa82a5 100644 --- a/pcb/rules/F5_2.py +++ b/pcb/rules/F5_2.py @@ -10,11 +10,7 @@ from rules.rule import * class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, "Fabrication layer requirements") + """Fabrication layer requirements""" # Check for presence of component value def checkMissingValue(self): diff --git a/pcb/rules/F5_3.py b/pcb/rules/F5_3.py index d91a2623..2626137b 100644 --- a/pcb/rules/F5_3.py +++ b/pcb/rules/F5_3.py @@ -16,11 +16,7 @@ from boundingbox import BoundingBox class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, "Courtyard layer requirements") + """Courtyard layer requirements""" # Get the superposed boundary of pads and fab layer def getFootprintBounds(self): diff --git a/pcb/rules/F5_4.py b/pcb/rules/F5_4.py index bf8ad84a..a7dae5d4 100644 --- a/pcb/rules/F5_4.py +++ b/pcb/rules/F5_4.py @@ -10,11 +10,7 @@ from rules.rule import * class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, "Elements on the graphic layer should not overlap") + """Elements on the graphic layer should not overlap""" def getCirclesOverlap(self,circles): def is_same(c1, c2): diff --git a/pcb/rules/F6_1.py b/pcb/rules/F6_1.py index 8ae77968..fae40ba5 100644 --- a/pcb/rules/F6_1.py +++ b/pcb/rules/F6_1.py @@ -5,11 +5,7 @@ from rules.rule import * class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, 'For surface-mount devices, placement type must be set to "Surface Mount"') + """For surface-mount devices, placement type must be set to "Surface Mount" """ def check(self): """ diff --git a/pcb/rules/F6_2.py b/pcb/rules/F6_2.py index 77c9ac2e..93274923 100644 --- a/pcb/rules/F6_2.py +++ b/pcb/rules/F6_2.py @@ -6,11 +6,7 @@ from math import sqrt class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args,'For surface-mount devices, footprint anchor is placed in the middle of the footprint (IPC-7351).') + """For surface-mount devices, footprint anchor is placed in the middle of the footprint (IPC-7351).""" def check(self): """ diff --git a/pcb/rules/F6_3.py b/pcb/rules/F6_3.py index ce939fb2..427f742d 100644 --- a/pcb/rules/F6_3.py +++ b/pcb/rules/F6_3.py @@ -3,14 +3,10 @@ from rules.rule import * class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, 'Pad requirements for SMD footprints') - - self.required_layers = ["Cu", "Paste", "Mask"] - self.sides = ["F.", "B."] + """Pad requirements for SMD footprints""" + + required_layers = ["Cu", "Paste", "Mask"] + sides = ["F.", "B."] def checkPads(self, pads): diff --git a/pcb/rules/F7_1.py b/pcb/rules/F7_1.py index 6686a7d8..d19ffd0b 100644 --- a/pcb/rules/F7_1.py +++ b/pcb/rules/F7_1.py @@ -5,11 +5,7 @@ from rules.rule import * class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, 'For through-hole devices, placement type must be set to "Through Hole"') + """For through-hole devices, placement type must be set to "Through Hole" """ def check(self): """ diff --git a/pcb/rules/F7_2.py b/pcb/rules/F7_2.py index 04e9401d..f8b89785 100644 --- a/pcb/rules/F7_2.py +++ b/pcb/rules/F7_2.py @@ -3,14 +3,10 @@ from rules.rule import * class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, 'For through-hole components, footprint anchor is set on pad 1') - - self.pin1_position = [] - self.pin1_count = 0 + """For through-hole components, footprint anchor is set on pad 1""" + + pin1_position = [] + pin1_count = 0 def check(self): """ diff --git a/pcb/rules/F7_3.py b/pcb/rules/F7_3.py index 5a8fc5d8..700a2713 100644 --- a/pcb/rules/F7_3.py +++ b/pcb/rules/F7_3.py @@ -3,14 +3,10 @@ from rules.rule import * class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, 'Pad 1 should be denoted by rectangular pad') - - self.names = ['1', 'A', 'A1', 'P1', 'PAD1'] - self.pad_1_shapes = ['rect', 'roundrect'] + """Pad 1 should be denoted by rectangular pad""" + + names = ['1', 'A', 'A1', 'P1', 'PAD1'] + pad_1_shapes = ['rect', 'roundrect'] def check(self): diff --git a/pcb/rules/F7_4.py b/pcb/rules/F7_4.py index 6052d384..7fc5ee24 100644 --- a/pcb/rules/F7_4.py +++ b/pcb/rules/F7_4.py @@ -15,15 +15,9 @@ from rules.rule import * class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, 'Pad requirements for THT footprints') - - self.required_layers = ["*.Cu","*.Mask"] - + """Pad requirements for THT footprints""" + required_layers = ["*.Cu","*.Mask"] def checkPads(self, pads): diff --git a/pcb/rules/F7_5.py b/pcb/rules/F7_5.py index 2a3549a8..165d0ff7 100644 --- a/pcb/rules/F7_5.py +++ b/pcb/rules/F7_5.py @@ -5,11 +5,7 @@ from rules.rule import * class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, 'Annular ring must be at least 0.15mm') + """Minimum annular ring width""" def checkPad(self, pad): if not 'size' in pad['drill']: diff --git a/pcb/rules/F7_6.py b/pcb/rules/F7_6.py index ea90735b..ebadb740 100644 --- a/pcb/rules/F7_6.py +++ b/pcb/rules/F7_6.py @@ -3,11 +3,7 @@ from rules.rule import * class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, 'Minimum hole drill size') + """Minimum hole drill size""" def checkPad(self, pad): diff --git a/pcb/rules/F9_1.py b/pcb/rules/F9_1.py index 2477e207..2ad4486a 100644 --- a/pcb/rules/F9_1.py +++ b/pcb/rules/F9_1.py @@ -4,11 +4,7 @@ import os class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, 'Footprint metadata must be filled as appropriate') + """Footprint meta-data is filled in as appropriate""" def checkDocs(self): mod = self.module diff --git a/pcb/rules/F9_2.py b/pcb/rules/F9_2.py index 32757726..41bb7f4e 100644 --- a/pcb/rules/F9_2.py +++ b/pcb/rules/F9_2.py @@ -3,11 +3,7 @@ from rules.rule import * class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, 'Footprint properties should be left to default values.') + """Footprint properties should be left to default values""" def check(self): """ diff --git a/pcb/rules/F9_3.py b/pcb/rules/F9_3.py index 3c6f48e9..58cf3a40 100644 --- a/pcb/rules/F9_3.py +++ b/pcb/rules/F9_3.py @@ -7,9 +7,7 @@ SYSMOD_PREFIX = "${KISYS3DMOD}/" class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad_mod files. - """ + """Footprint 3D model requirements""" # Regular expression for suffixes that shouldn't be in the model file suffix_re = ( @@ -21,9 +19,6 @@ class Rule(KLCRule): ')' ) - def __init__(self, module, args): - super(Rule, self).__init__(module, args, '3D model settings') - def checkModel(self, model): error = False diff --git a/pcb/rules/G1_1.py b/pcb/rules/G1_1.py index c564e35d..92c43d8d 100644 --- a/pcb/rules/G1_1.py +++ b/pcb/rules/G1_1.py @@ -4,15 +4,12 @@ import re class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad lib files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, 'Illegal characters in footprint name') - # Set of allowed chars. Some characters need to be escaped. - allowed_chars = "a-zA-Z0-9_\-\.,\+" - self.pattern = re.compile('^['+allowed_chars+']+$') - self.forbidden = re.compile('([^'+allowed_chars+'])+') + """Only standard characters are used for naming libraries and components""" + + # Set of allowed chars. Some characters need to be escaped. + allowed_chars = "a-zA-Z0-9_\-\.,\+" + pattern = re.compile('^['+allowed_chars+']+$') + forbidden = re.compile('([^'+allowed_chars+'])+') def check(self): name = str(self.module.name).lower() diff --git a/pcb/rules/G1_7.py b/pcb/rules/G1_7.py index 0975e709..233a1eda 100644 --- a/pcb/rules/G1_7.py +++ b/pcb/rules/G1_7.py @@ -4,11 +4,7 @@ import platform class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad lib files. - """ - def __init__(self, module, args): - super(Rule, self).__init__(module, args, 'Library files must use Unix-style line endings (LF)') + """Library files must use Unix-style line endings (LF)""" def check(self): diff --git a/pcb/rules/rule.py b/pcb/rules/rule.py index 7231c641..5b79687d 100644 --- a/pcb/rules/rule.py +++ b/pcb/rules/rule.py @@ -100,9 +100,9 @@ class KLCRule(KLCRuleBase): """ A base class to represent a KLC rule """ - def __init__(self, module, args, description): + def __init__(self, module, args): - KLCRuleBase.__init__(self, description) + KLCRuleBase.__init__(self) self.module = module self.args = args diff --git a/schlib/check_kicad_sym.py b/schlib/check_kicad_sym.py index 3deaf50c..07518be5 100755 --- a/schlib/check_kicad_sym.py +++ b/schlib/check_kicad_sym.py @@ -28,7 +28,7 @@ def do_unittest(symbol, rules, metrics): for rule in rules: rule.footprints_dir = args.footprints if args.footprints else None rule = rule(symbol) - if unittest_rule == rule.name and rule.v6 == True: + if unittest_rule == rule.name: rule.check() if unittest_result == 'Fail' and rule.errorCount == 0: printer.red("Test '{sym}' failed".format(sym=symbol.name)) @@ -56,14 +56,9 @@ def do_rulecheck(symbol, rules, metrics): rule.footprints_dir = args.footprints if args.footprints else None rule = rule(symbol) - # check if this rule already is v6 compatible - if rule.v6 == True: - if verbosity > 2: - printer.white("Checking rule " + rule.name) - rule.check() - else: - continue - + if verbosity > 2: + printer.white("Checking rule " + rule.name) + rule.check() if args.nowarnings and not rule.hasErrors(): continue diff --git a/schlib/rules/EC02.py b/schlib/rules/EC02.py index ed2a448c..0860628b 100644 --- a/schlib/rules/EC02.py +++ b/schlib/rules/EC02.py @@ -4,12 +4,7 @@ class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad lib files. - """ - v6 = True - def __init__(self, component): - super(Rule, self).__init__(component, 'Check part reference, name and footprint position and alignment') + """Check part reference, name and footprint position and alignment""" def check(self): """ diff --git a/schlib/rules/G1_1.py b/schlib/rules/G1_1.py index f9bcd07a..f961b869 100644 --- a/schlib/rules/G1_1.py +++ b/schlib/rules/G1_1.py @@ -5,12 +5,7 @@ class Rule(KLCRule): - v6 = True - """ - Create the methods check and fix to use with the kicad lib files. - """ - def __init__(self, component): - super(Rule, self).__init__(component, 'Illegal characters in symbol name') + """Only standard characters are used for naming libraries and components""" def check(self): diff --git a/schlib/rules/G1_7.py b/schlib/rules/G1_7.py index c2095df1..8ba1e51d 100644 --- a/schlib/rules/G1_7.py +++ b/schlib/rules/G1_7.py @@ -4,13 +4,8 @@ import platform class Rule(KLCRule): - v6 = True - """ - Create the methods check and fix to use with the kicad lib files. - """ - def __init__(self, component): - super(Rule, self).__init__(component, 'Library files must use Unix-style line endings (LF)') - self.lib_error = False + """Library files must use Unix-style line endings (LF)""" + lib_error = False def check(self): # Only perform this check on linux systems (i.e. Travis) diff --git a/schlib/rules/S3_1.py b/schlib/rules/S3_1.py index c5786f1a..b2c7bcb0 100644 --- a/schlib/rules/S3_1.py +++ b/schlib/rules/S3_1.py @@ -5,12 +5,7 @@ class Rule(KLCRule): - v6 = True - """ - Create the methods check and fix to use with the kicad lib files. - """ - def __init__(self, component): - super(Rule, self).__init__(component, 'Origin is centered on the middle of the symbol') + """Origin is centered on the middle of the symbol""" def check(self): """ diff --git a/schlib/rules/S3_2.py b/schlib/rules/S3_2.py index 8d34081c..a72bc4c1 100644 --- a/schlib/rules/S3_2.py +++ b/schlib/rules/S3_2.py @@ -4,12 +4,7 @@ class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad lib files. - """ - v6 = True - def __init__(self, component): - super(Rule, self).__init__(component, 'Text properties should use common size of 50mils, but labels and numbers may use text size as low as 20mil if required') + """Text fields should use a common text size of 50mils""" def check(self): """ diff --git a/schlib/rules/S3_3.py b/schlib/rules/S3_3.py index 431e7949..29bf1aec 100644 --- a/schlib/rules/S3_3.py +++ b/schlib/rules/S3_3.py @@ -5,12 +5,7 @@ class Rule(KLCRule): - v6 = True - """ - Create the methods check and fix to use with the kicad lib files. - """ - def __init__(self, component): - super(Rule, self).__init__(component, 'Symbol outline and fill requirements') + """Symbol outline and fill requirements""" def check(self): """ diff --git a/schlib/rules/S3_6.py b/schlib/rules/S3_6.py index 05036d49..ba40b6f9 100644 --- a/schlib/rules/S3_6.py +++ b/schlib/rules/S3_6.py @@ -4,12 +4,7 @@ class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad lib files. - """ - v6 = True - def __init__(self, component): - super(Rule, self).__init__(component, 'Pin name position offset') + """Pin name position offset""" def check(self): # no need to check this for an alias diff --git a/schlib/rules/S4_1.py b/schlib/rules/S4_1.py index 3bc47355..725e4d41 100644 --- a/schlib/rules/S4_1.py +++ b/schlib/rules/S4_1.py @@ -4,28 +4,7 @@ class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad lib files. - """ - v6 = True - def __init__(self, component): - super(Rule, self).__init__(component, 'Pin requirements') - - def checkMissingPins(self): - int_pins = [] - for pin in self.component.pins: - try: - int_pins.append(int(pin.number)) - except: - pass - - if len(int_pins) == 0: - return False - - for i in range(1, max(int_pins) + 1): - if i not in int_pins: - self.warning("Pin {n} is missing".format(n=i)) - return False + """General pin requirements""" def checkPinOrigin(self, gridspacing=100): self.violating_pins = [] @@ -106,7 +85,6 @@ def check(self): warningPinLength = 49 return any([ - self.checkMissingPins(), self.checkPinOrigin(pingrid), self.checkPinLength(errorPinLength, warningPinLength), self.checkDuplicatePins() diff --git a/schlib/rules/S4_2.py b/schlib/rules/S4_2.py index 9f2f0f1e..787eed7d 100644 --- a/schlib/rules/S4_2.py +++ b/schlib/rules/S4_2.py @@ -5,12 +5,7 @@ class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad lib files. - """ - v6 = True - def __init__(self, component): - super(Rule, self).__init__(component, 'Pins should be arranged by function') + """Pins should be grouped by function""" def checkGroundPins(self): # Includes negative power pins diff --git a/schlib/rules/S4_3.py b/schlib/rules/S4_3.py index 72fd6f8b..55d85ca4 100644 --- a/schlib/rules/S4_3.py +++ b/schlib/rules/S4_3.py @@ -4,21 +4,15 @@ class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad lib files. - """ - special_power_pins = ['power_in', 'power_out', 'output'] - v6 = True - - def __init__(self, component): - super(Rule, self).__init__(component, 'Rules for pin stacking') - self.different_names = [] - self.different_types = [] - self.visible_pin_not_lowest = [] - self.NC_stacked = [] - self.non_numeric = [] - self.more_then_one_visible = False + """Rules for pin stacking""" + special_power_pins = ['power_in', 'power_out', 'output'] + different_names = [] + different_types = [] + visible_pin_not_lowest = [] + NC_stacked = [] + non_numeric = [] + more_then_one_visible = False def count_pin_etypes(self, pins, etyp): n = 0 diff --git a/schlib/rules/S4_4.py b/schlib/rules/S4_4.py index 838046d8..dfef83c8 100644 --- a/schlib/rules/S4_4.py +++ b/schlib/rules/S4_4.py @@ -5,7 +5,8 @@ class Rule(KLCRule): - v6 = True + """Pin electrical type should match pin function""" + # Power Input Pins should be 'W' POWER_INPUTS = ['^[ad]*g(rou)*nd(a)*$', '^[ad]*v(aa|cc|dd|ss|bat|in)$'] @@ -38,11 +39,6 @@ def test(self, pinName, nameList): return True return False - """ - Create the methods check and fix to use with the kicad lib files. - """ - def __init__(self, component): - super(Rule, self).__init__(component, 'Pin electrical type should match pin function') # These pin types must be satisfied def checkPowerPins(self): diff --git a/schlib/rules/S4_5.py b/schlib/rules/S4_5.py new file mode 100644 index 00000000..8a18096c --- /dev/null +++ b/schlib/rules/S4_5.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +from rules.rule import * + + +class Rule(KLCRule): + """Pins not connected on the footprint may be omitted from the symbol""" + + def checkMissingPins(self): + int_pins = [] + for pin in self.component.pins: + try: + int_pins.append(int(pin.number)) + except: + pass + + if len(int_pins) == 0: + return False + + missing_pins = [] + for i in range(1, max(int_pins) + 1): + if i not in int_pins: + missing_pins.append(i) + if len(missing_pins) != 0: + self.warning("Pin{s} {n} {v} missing.".format( + s="s" if len(missing_pins) > 1 else "", + n=", ".join(str(x) for x in missing_pins), + v="are" if len(missing_pins) > 1 else "is")) + return False + + def check(self): + # no need to check pins on an alias + if self.component.extends != None: + return False + + return self.checkMissingPins() + + def fix(self): + """ + Proceeds the fixing of the rule, if possible. + """ + + self.info("Fix not supported") diff --git a/schlib/rules/S4_6.py b/schlib/rules/S4_6.py index 8b23512b..5dc6c3b2 100644 --- a/schlib/rules/S4_6.py +++ b/schlib/rules/S4_6.py @@ -5,7 +5,7 @@ class Rule(KLCRule): - v6 = True + """Hidden pins""" # No-connect pins should be "N" NC_PINS = ['^nc$', '^dnc$', '^n\.c\.$'] @@ -18,12 +18,6 @@ def test(self, pinName, nameList): return False - """ - Create the methods check and fix to use with the kicad lib files. - """ - def __init__(self, component): - super(Rule, self).__init__(component, 'Unused pins should be set as NOT CONNECTED and should be INVISIBLE') - def checkNCPins(self, pins): self.invisible_errors = [] self.type_errors = [] diff --git a/schlib/rules/S5_1.py b/schlib/rules/S5_1.py index 5a132d1b..1819c0d0 100644 --- a/schlib/rules/S5_1.py +++ b/schlib/rules/S5_1.py @@ -5,17 +5,9 @@ class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad lib files. - """ - v6 = True - def __init__(self, component): - super(Rule, self).__init__(component, 'For components with a single default footprint, footprint field is filled with valid footprint filename') + """Symbols with a default footprint link to a valid footprint file""" def check(self): - """ - Proceeds the checking of the rule. - """ fail = False # get footprint from properties diff --git a/schlib/rules/S5_2.py b/schlib/rules/S5_2.py index 6102f62b..e034a508 100644 --- a/schlib/rules/S5_2.py +++ b/schlib/rules/S5_2.py @@ -5,12 +5,7 @@ class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad lib files. - """ - v6 = True - def __init__(self, component): - super(Rule, self).__init__(component, 'Footprint filters should match all appropriate footprints') + """Footprint filters should match all appropriate footprints""" def checkFilters(self, filters): diff --git a/schlib/rules/S6_2.py b/schlib/rules/S6_2.py index 4a71c310..d8873f2d 100644 --- a/schlib/rules/S6_2.py +++ b/schlib/rules/S6_2.py @@ -4,12 +4,7 @@ class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad lib files. - """ - v6 = True - def __init__(self, component): - super(Rule, self).__init__(component, 'Component fields contain the correct information') + """Symbol and alias fields and metadata filled out as required""" def checkReference(self): fail = False diff --git a/schlib/rules/S7_1.py b/schlib/rules/S7_1.py index eecd55e5..95a50d0b 100644 --- a/schlib/rules/S7_1.py +++ b/schlib/rules/S7_1.py @@ -5,24 +5,16 @@ class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad lib files. - """ - v6 = True - def __init__(self, component): - super(Rule, self).__init__(component, 'Power-flag symbols follow some special rules/KLC-exceptions') - self.makePinINVISIBLE = False - self.makePinPowerInput = False - self.fixTooManyPins = False - self.fixPinSignalName = False - self.fixNoFootprint = False + """Power flag symbols""" + makePinINVISIBLE = False + makePinPowerInput = False + fixTooManyPins = False + fixPinSignalName = False + fixNoFootprint = False def check(self): - """ - Proceeds the checking of the rule. - """ - fail = False + if self.component.is_power_symbol(): if (len(self.component.pins) != 1): self.error("Power-flag symbols have exactly one pin") diff --git a/schlib/rules/S7_2.py b/schlib/rules/S7_2.py index 9d8fe59d..e035f23b 100644 --- a/schlib/rules/S7_2.py +++ b/schlib/rules/S7_2.py @@ -5,19 +5,11 @@ class Rule(KLCRule): - """ - Create the methods check and fix to use with the kicad lib files. - """ - v6 = True - def __init__(self, component): - super(Rule, self).__init__(component, 'Graphical symbols follow some special rules/KLC-exceptions') - self.fixTooManyPins = False - self.fixNoFootprint = False + """Graphical symbols follow some special rules/KLC-exceptions""" + fixTooManyPins = False + fixNoFootprint = False def check(self): - """ - Proceeds the checking of the rule. - """ # no need to check this for an alias if self.component.extends != None: return False diff --git a/schlib/rules/__init__.py b/schlib/rules/__init__.py index 19848b4b..8b83f21c 100644 --- a/schlib/rules/__init__.py +++ b/schlib/rules/__init__.py @@ -12,6 +12,7 @@ "S4_2", "S4_3", "S4_4", +"S4_5", "S4_6", "S5_1", diff --git a/schlib/rules/rule.py b/schlib/rules/rule.py index 58cb8209..df4caa44 100644 --- a/schlib/rules/rule.py +++ b/schlib/rules/rule.py @@ -35,13 +35,12 @@ def positionFormater(element): class KLCRule(KLCRuleBase): - """ - A base class to represent a KLC rule - """ + """A base class to represent a KLC rule + Create the methods check and fix to use with the kicad lib files. + """ verbosity = 0 - v6 = False - def __init__(self, component, description): - KLCRuleBase.__init__(self, description) + def __init__(self, component): + KLCRuleBase.__init__(self) self.component = component