svenkreiss / html5validator

Command line tool to validate HTML5 files. Great for continuous integration.
MIT License
314 stars 34 forks source link

API for programmatic access to error messages #61

Open bemoody opened 4 years ago

bemoody commented 4 years ago

For some applications, it's useful to be able to access the full details of the messages reported by the validator (for example, so they can report errors in a more user-friendly format.) This is an interface that would allow Python programs to do that.

Suggestions and critiques are welcome - the precise details of the interface aren't terribly important to me, but for my application it would be really useful to have some API that works along these lines.

Fixes issue #60.

bittner commented 4 years ago

@bemoody Any plans to finish this PR?

At least, the branch must be rebased and conflicts resolved.

bemoody commented 4 years ago

Sure thing. Here is an updated version. The only changes are rebasing and the addition of some simple test cases.

bemoody commented 4 years ago

With further fixes to placate the test suite.

However, "flake8" gives warnings on validator.py lines 202 and 205 (lines 174 and 177 in the master branch), which are unrelated to these changes.

bittner commented 4 years ago

However, "flake8" gives warnings on validator.py lines 202 and 205 (lines 174 and 177 in the master branch), which are unrelated to these changes.

This is normal, and happens in all projects, recently. The story is that Flake8 got its rules updated to identify code that is hard to understand. This is exactly the case in line 202-205.

I think that deserves fixing, also in this PR, as a side-job. As an act of good citizenship. Simply try to figure out what is the meaning of the code and turn the variable names into something self-explanatory (i.e. long names that actually tell a story).

svenkreiss commented 4 years ago

I don't share that opinion. A PR doesn't have to fix unrelated errors.

Thanks for updating @bemoody . Looks good to me.

frodeseverin commented 1 year ago

Sadly, this feature seems to have not yet been reviewed. Waiting anxiously for this code to make it into the main branch.

bemoody commented 1 year ago

I've rebased and re-implemented get_messages based on the current main branch.

Otherwise, the API should work the same way as before. Hope this works!