Juris-M / legal-resource-registry

Jurisdiction ID and abbreviation data files for using with Jurism and other projects.
MIT License
31 stars 37 forks source link

jurisupdate fails #37

Closed georgd closed 3 years ago

georgd commented 3 years ago

Something’s going wrong with my current version of juris-de-desc.json (see PR).

I can‘t find anything invalid – neither non-ASCII-chars in keys, nor illegal whitespace.

$ jurisupdate -j de
Using /Users/gduffner/Documents/dev/legal-resource-registry/src as path for descriptive jurisdiction files
Will read descriptive jurisdiction files from: /Users/gduffner/Documents/dev/legal-resource-registry/src
Will write abbreviation files to: /Users/gduffner/Zotero/juris-abbrevs
Will write compact jurisdiction files to: /Users/gduffner/Zotero/juris-maps
de
Writing /Users/gduffner/Zotero/juris-abbrevs/auto-de.json
Writing /Users/gduffner/Zotero/juris-abbrevs/auto-de-deAlt.json
Writing /Users/gduffner/Zotero/juris-abbrevs/auto-de-enIBFD.json
ERROR: Unexpected token b in JSON at position 0
georgd commented 3 years ago

@fbennett could you please have a look at this? I’m trying to create a proper style-module for DE but nothing’s working there and I want to exclude an issue with the abbreviations first.

fbennett commented 3 years ago

Sorry for missing this. Will take a look right away.

On Tue, Jan 26, 2021, 22:29 Georg Mayr-Duffner notifications@github.com wrote:

@fbennett https://github.com/fbennett could you please have a look at this? I’m trying to create a proper style-module for DE but nothing’s working there and I want to exclude an issue with the abbreviations first.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Juris-M/legal-resource-registry/issues/37#issuecomment-767540848, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAASMSWNL7SKNUPMWUB63UTS327RVANCNFSM4WDEUX4A .

fbennett commented 3 years ago

I merged the PR and it works here. I also tried pulling the master branch from your fork, and that works as well. From the code of the script, it looks like it's failing on ./juris-maps/versions.json in your data directory. The script reads and parses that file, updates it, then serializes it back to disk. The script should handle a parse failure by rebuilding the file, but it currently doesn't. Check the file, if it's not good JSON, that's our issue, and I'll fix the script to handle it properly.

fbennett commented 3 years ago

I've pushed some changes to the script that should catch any parsing errors, both in juris-maps/versions.json and in map files that are not overwritten by the call to the script. The error messages should provide some meaningful guidance.

fbennett commented 3 years ago

The revision should help, but the logic isn't very elegant for global updates, where it repeatedly parses all files when updating each jurisdiction. I'll look at cleaning that up, but the current master should work for you.

fbennett commented 3 years ago

I've pushed another (and final, pending feedback) revision to rationalize updates. With the latest commits, it validates all map files, regenerating versions.json if necessary, then updates only the files that will change.

georgd commented 3 years ago

Great, thank you! the error is gone now.

fbennett commented 3 years ago

I've made a change in citeproc-test-runner to proceed to the next test when the -k option is used, instead of rerunning the whole set. It will save time when a single style edit causes a large number of style tests to (incorrectly) fail for the same reason.