-
Notifications
You must be signed in to change notification settings - Fork 121
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
Added new feature to fail based on different conditions #363
Added new feature to fail based on different conditions #363
Conversation
37b32b2
to
20f4c02
Compare
Added README, no more changes to make. |
no comments? cc @mojavelinux |
Hello, Overall, I'd be interested in having the build fail whenever there's a missing file to include, image to embed, etc. I understand that the feature addressed by this PR could help me do what I want, short of being able to configure asciidoctor to emit ERRORS instead of WARNINGS. Just so you know there are people around here watching the progress of the Pull Request ;-) |
Hey, just built locally and tried the new feature (why haven't I done so earlier? dunno…) The On a side note, the
|
Well, maybe I spoke a little bit too early @abelsromero : when I stop deliberately putting errors (e.g. including inexistant files) in my asciidocs, then I expect the build to succeed.
|
I like the proposal and I'm glad you decided to move forward with it. I think the If there are improvements to be made, I agree we should handle them as discrete issues. You don't want an issue to get so huge it never gets delivered. |
Addresses: #261, #178
Features are complete, but there's an issue with duplicated asciidoctor messages asciidoctor/asciidoctorj#669. Depending on suggestions we can merge or review the feature.
Feature summary
This PR adds a new configuration element as follows:
outputToConsole
: redirects asciidoctor messages to maven's logger. Messages are shown as Maven's INFO during renderitzation. Messages will appear twice as mentioned in issue Unable to prevent messages from showing in console using LogHandler asciidoctorj#669.severity
: named so to align with AsciidoctorJ property. Will make the build fail if a message of this severity level is found.It only matches the exact level, not same and above. I did this for simplicity but I am open to suggestions, implementation is trivial.I finally decided to filter all messages above certain level to allow capturing all messages easily, also, feels more natural to understand.containsText
: named so instead ofmatchesText
because it just asserts that, acontains
. I considered the option of allowing regex, but this made configuration more complex and less expressive for simple cases like a simple contains. Adding regex options could be done with another option or some custom syntax in the field.Note that if both
severity
andcontainsText
are set, only messages that match both are captured.Messages that match
severity
and/orcontainsText
are shown as Maven ERROR (independently fromoutputToConsole
), so that CIs can capture them as cause of build fail. Also, an initial error message showing the number of issues found is returned.If someone wants to create a custom report like mentioned in #261, you can register a custom LogHandler using the SPI interface (added integration test for that). However, this has some limitations with some formats that need to "close" and estructure (see asciidoctor/asciidoctor#2832).
Other notes
severity
andcontainsText
are validated after the renderitzation the target document (html, pdf, etc.) can be found in the target directory. I don't see any reason to delete it.Other changes to code
InlineMacroProcessor
test extension to new especificationjruby-complete
to 9.1.16.0: updatedmaven-plugin-plugin
from 3.4 to 3.5 to fix issue after updatingjruby-complete
I kept code as Java 7 compatible, but AsciidoctorJ is 1.8. I'd add that to docs and release notes when PR is agreed. I did not want to add more things to the mix.