Skip to content
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

Filtering validation error messages for CI process #391

Closed
violinner opened this issue Oct 28, 2016 · 4 comments
Closed

Filtering validation error messages for CI process #391

violinner opened this issue Oct 28, 2016 · 4 comments

Comments

@violinner
Copy link

For a continuous integration build process, I am using validator as a library called by an automated test framework. The validation is intended to screen for high-risk errors, and needs to ignore many others.

Is there a built-in or maintainable way to filter a list of specific errors to ignore?

@violinner violinner changed the title Filtering error messages for CI building Filtering error messages for CI process Oct 28, 2016
@violinner violinner changed the title Filtering error messages for CI process Filtering validation error messages for CI process Oct 28, 2016
@sideshowbarker
Copy link
Contributor

sideshowbarker commented Oct 29, 2016

There is is not yet a built-in or maintainable way to filter a list of specific errors to ignore. We would welcome a patch for one.

Other projects have dealt with the deficiency by adding their own filtering mechanisms. See for example the code that the (Java) lmvtfy tool uses to ignore certain errors or see the backend for the ignore option in (JavaScript) grunt-html.

If your implementation is in Java, @cvrebert (lmvtfy author) especially might be able to give you some guidance on how best to add filtering.

@violinner
Copy link
Author

I have a working filter based on a copy of MessageEmitterAdapter (cannot extend a final class), with a call to a filtering discriminator "isAllowed()" in methods warning() and error(). A JSON persisted configuration class is used to load ignored error and warning messages, which has a "debug" flag that ignores everything and prints a uniquely sorted list of all the errors encountered-- potentially to add some of them to the "ignored" list. Everything is chained through a Selenium and ChromeDriver browser test framework.

There are two problems so far: 1) Testing is difficult (changed a number of private methods to public to unit test), and 2) method MessageEmitterAdapter.elaboration(Exception e) has some dead code due to two cases testing for "if (e instanceof StringNotAllowedException)"

I will try to post the suggested changes soon.

@sideshowbarker
Copy link
Contributor

Thanks for the update—sounds like good progress

sideshowbarker added a commit that referenced this issue Apr 10, 2017
This change adds a new `filterpattern` param to the Web checker and network API.

Use the `filterpattern` param to filter out (drop/ignore/suppress) errors and
warnings you don’t care about/don’t want to see/don’t consider to be a problem.

The `filterpattern` value must be a (percent-encoded) regex. Any error/warning
messages matching the regex will be filtered out (dropped/ignored/suppressed).

A similar option will also be added to the vnu.jar command-line checker soon.

Relates to #391
@sideshowbarker
Copy link
Contributor

Given that the checker does now have a message-filtering feature and it’s documented at https://github.com/validator/validator/wiki/Message-filtering, I’m gonna go ahead and close this out. But feel free to comment here if any clarification is needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants