-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fall back to regular diff in case of malformed xml #7
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless I'm mistaken, with this change we simply ignore errors and fall back to a regular diff of the original files instead. I suppose this is ok, but the user should be presented with a warning when any of the input files are malformed, warning them that the tool falls back to a regular diff...
tmp1.flush() | ||
actual = tmp1.name | ||
except ET.ParseError: | ||
actual = file1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in case the XML has errors, we simply fall back to a diff of the original files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add a warning, indeed, but then it will break the integration with other programs where you don't want or expect other kind of outputs (which is my case). I guess the good way would be to use a logger and pass a parameter to run in silence. An alternative is to just document this (logical) behavior in the README.
tmp1.flush() | ||
actual = tmp1.name | ||
except ET.ParseError: | ||
actual = file1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes!
Avoids crashing when comparing malformed xml files