KiCad / kicad-library-utils

Some scripts for helping with library development
GNU General Public License v3.0
128 stars 95 forks source link

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

Open JacobEFO opened 4 years ago

JacobEFO commented 4 years ago

A naive approach to handling space separated keywords fixing #321

The thought was, that it would be more interesting to find keywords separated with a list of illegal symbols, such as: ,.:;?!<>

Currently allowing especially hyphen (-) to get through, because it appears to be used already within keywords. A primary issue atm is, that some symbols such as within CPLD_Xilinx.lib contain no "K" field in its .dcm file. This triggered an error, that I handle with a try/except.

if the error is triggered it appends to the warnings, that symbols appear to not have any keywords. If illegal characters are found within the keywords, an error is appended saying it found the following illegal characters and prints them.

I would like to hear, what you think of the solution, and what specific sort of characters should be searched for within the keywords.

cpresser commented 4 years ago

I think we need to discuss the list of illegal symbols. I think the dot . should be allowed, for example in 3.3V LDO or 66.6MHz clock

edit: I was thinking of description where different rules apply. @JacobEFO can you explain how you came up with that list and what the reasoning behind each item is?

JacobEFO commented 4 years ago

Hey @cpresser

The list of symbols was merely a suggestion/prototype. The list is not exhaustive. There may be other more interesting symbols to filter from or some to exclude. It is merely just a suggestion as to symbols people may end up using instead of a space for seperation of keywords. I don't necessarily expect anyone to use "!?<>" but was just used for testing.

Realistic symbols may be more: ",.:;|" or similarly. Using this list of illegal symbols is just a simple yet efficient way to handle keyword seperation. It would be hard to detect someone not using any sort of separator, say: "lowvoltageopamp" would be cumbersome to check for, whereas assuming someone may end up writing "lowvoltage,opamp" is reasonable.

cpresser commented 3 years ago

I did a little testing and think that . should not be in that list. There is the use-case of things like 3.3V Perhaps you can write a re that allows the dot character only if it is followed by a word character.

Missing keywords generating a warning is good. I like that.