klauer / blark

Beckhoff TwinCAT ST (IEC 61131-3) code parsing in Python using Lark (Earley)
https://klauer.github.io/blark/
GNU General Public License v2.0
42 stars 5 forks source link

FIX: ignore global text list project files #81

Closed klauer closed 1 year ago

klauer commented 1 year ago

Fix GlobalTextList loading bug

Projects with GlobalTextList entries in TwinCAT projects would previously raise: RuntimeError: Unsupported xml type for TcSource: <Element TcPlcObject at 0x7f70fc315340> For one, that exception message has been improved to include a bit more context: UnsupportedSourceFileError: Unsupported xml type for TcSource: TcPlcObject/GlobalTextList

If loaded directly with the TcSource.from_filename utility method, the above will be raised. If loaded as part of a solution/tsproj, the unsupported source file will just be ignored.

Test suite changes

codecov-commenter commented 1 year ago

Codecov Report

Merging #81 (d89aa43) into master (f7e0ecf) will increase coverage by 0.2%. The diff coverage is 84.0%.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/klauer/blark/pull/81/graphs/tree.svg?width=650&height=150&src=pr&token=QZDTKF30TH&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=K+Lauer)](https://app.codecov.io/gh/klauer/blark/pull/81?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=K+Lauer) ```diff @@ Coverage Diff @@ ## master #81 +/- ## ======================================== + Coverage 79.6% 79.9% +0.2% ======================================== Files 26 26 Lines 5491 5505 +14 ======================================== + Hits 4374 4399 +25 + Misses 1117 1106 -11 ``` | [Files Changed](https://app.codecov.io/gh/klauer/blark/pull/81?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=K+Lauer) | Coverage Δ | | |---|---|---| | [blark/tests/test\_dependency\_store.py](https://app.codecov.io/gh/klauer/blark/pull/81?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=K+Lauer#diff-YmxhcmsvdGVzdHMvdGVzdF9kZXBlbmRlbmN5X3N0b3JlLnB5) | `78.5% <ø> (ø)` | | | [blark/solution.py](https://app.codecov.io/gh/klauer/blark/pull/81?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=K+Lauer#diff-Ymxhcmsvc29sdXRpb24ucHk=) | `79.5% <84.0%> (+0.6%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/klauer/blark/pull/81/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=K+Lauer)
klauer commented 1 year ago

Tests all passing and this is looking good on my local parsing tests - merging