-
-
Notifications
You must be signed in to change notification settings - Fork 3
No default features #430
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
base: main
Are you sure you want to change the base?
No default features #430
Conversation
a6c7961
to
733a049
Compare
<flakyError type="flaky error type">flaky error description | ||
<stackTrace>flaky stack trace</stackTrace> | ||
<system-out>flaky system output</system-out> | ||
<system-err>flaky system error with [34mANSI escape codes[39m</system-err> |
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.
Without the ansi-escape feature flag, ANSI escape codes are just added to the XML. It looks like there is actually no additional escaping necessary to be valid XML (but if it were, quick-xml would take care of it).
Of course we shouldn't have unescaped ANSI codes in here, but in many cases you may know that the target application is never producing them in the first place.
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.
Interesting -- I think a newer version of quick-xml might be doing some filtering here.
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.
Thanks for working on this!
[features] | ||
default = ["timestamps", "uuids", "strip-ansi"] | ||
timestamps = ["dep:chrono"] | ||
uuids = ["dep:uuid", "dep:newtype-uuid"] |
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.
Let's call this feature uuid
.
@@ -11,14 +11,20 @@ categories = ["encoding", "development-tools"] | |||
edition = "2021" | |||
rust-version = "1.70" | |||
|
|||
[features] | |||
default = ["timestamps", "uuids", "strip-ansi"] |
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.
I'd make timestamps
default and the other two non-default.
#[cfg(feature = "strip-ansi")] | ||
let data = strip_ansi_escapes::strip_str(data); |
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.
This isn't right -- enabling a feature shouldn't cause this kind of behavior change. Instead I'd recommend adding an alternative constructor.
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.
To clarify, you mean something like XmlString::escape_ansi() -> Self
? XmlString::new
would not do automatic stripping and consumers would use this alternative constructor if they need to strip ANSI escapes?
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.
For backwards compatibility, I think new
should retain the strip-ansi behavior, and there should be a separate constructor that only removes bytes illegal in XML without stripping ANSI codes. The latter could be called new_minimal
or something. (This also suggests that the strip-ansi
feature should be turned on by default.)
Oh it looks like in the loop below, it's quick-junit that's doing the filtering of illegal bytes.
<flakyError type="flaky error type">flaky error description | ||
<stackTrace>flaky stack trace</stackTrace> | ||
<system-out>flaky system output</system-out> | ||
<system-err>flaky system error with [34mANSI escape codes[39m</system-err> |
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.
Interesting -- I think a newer version of quick-xml might be doing some filtering here.
This PR fixes #429. I've moved uuid, chrono and strip-ansi-escapes into optional (on-by-default) features, and then made sure this configuration is tested in CI as well.
Thank you for building and maintaining quick-junit! 🍰