diff --git a/CHANGELOG.md b/CHANGELOG.md index 70bcdb14..53e5df6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- Discarded spaces at the beggining and end of user fields when creating the + internal BoM. They are ususally mistakes that prevents grouping components. + ### Fixed - The variants logic for BoMs when a component resquested to be only added to more than one variant. diff --git a/kibot/kicad/v5_sch.py b/kibot/kicad/v5_sch.py index 1dd9ffca..da8f9f6d 100644 --- a/kibot/kicad/v5_sch.py +++ b/kibot/kicad/v5_sch.py @@ -774,6 +774,14 @@ class SchematicComponent(object): comp.sheet_path_h = sheet_path_h if GS.debug_level > 1: logger.debug("- Loaded component {}".format(comp)) + # Report abnormal situations + for field in comp.fields: + cur_val = field.value + stripped_val = cur_val.strip() + if len(cur_val) != len(stripped_val): + logger.warning("Field {} of component {} ({}) contains extra spaces: `{}` removing them.". + format(field.name, comp.ref, comp.name, field.value)) + field.value = stripped_val return comp