Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit adds more colorful and easier to scan validation output for the CLI.
To support this change, I needed to introduce a new validation event formatter that uses ANSI codes. Updating the existing formatter would have added a ton of composition to it, making it hard to understand.
When breaking out a new validation event formatter, I noticed some duplicate code in handling: 1) creating a human-readable filename 2) loading a line of text from a source location.
To account for (1), I added getHumanReadableFilename() to ValidationEvent.
To account for (2), I created a new abstraction for grabbing source context from a SourceLocation.
I ended up needing an abstraction for emitting lots of content that's wrapped in ANSI color escapes, and I didn't want to add escapes over and over or have to buffer intermediate output to a string, so I added a method for wrapping a Consumer that handles adding ANSI styles before and after the consumer is called.
Style was updated to an interface in case we ever want to support theming and use HEX code colors.
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.