SoFriendly / 2fhey

Creative Commons Zero v1.0 Universal
115 stars 23 forks source link

Support a local copy of matching rules for testing new patterns and fixes to old ones #47

Closed tomhundt closed 5 months ago

tomhundt commented 6 months ago

Guys, if you want us to do a PR to the AppConfig.json file to add new message formats (e.g., #19 ), that's not very testable, is it? What with the different flavors of regex parsers and stuff, it'd be a lot safer and more robust if we could test a new entry for a while before committing.

May I suggest that the app look for a local copy (in ~/Library/Preferences or whatever) and let its contents overlay the Github one. This sort of setup would also let us help fix entries that are broken, and patch them on our own. (Looking at the existing list, it's very US-English so there are probably thousands of possible additions in other languages.)

Looking at the code real quick, it appears (in ParserConfigManager) you're downloading the AppConfig file to ~/Library/Application Support/com.sofriendly.2fhey/2fheyConfiguration.json -- but that doesn't exist on mine, and if I create it and put junk in it, doesn't bother the application any. (I'm not a Swift dev, so this is guesswork.) Maybe if you tell us what is going on there, we could already have most of what's requested here. (Ideally add it to the README?) Thanks!

itsthisjustin commented 6 months ago

Love this idea. Let me see if I can add a simple way to reference a local file for testing purposes

ichoosetoaccept commented 5 months ago

Excellent idea.. I added a custom pattern today and could not test it locally. It's not ideal having to wait for a PR merge to be approved and merged before learning if a contribution is working or not.

itsthisjustin commented 5 months ago

So I updated the app such that it downloads the parsing json directly to your documents folder. You can now edit that file locally to test easily.