Skip to content

Commit

Permalink
Merge pull request #35 from svenkreiss/ignore-java-env-var-message
Browse files Browse the repository at this point in the history
ignore a message from JDK about picking up env variables
  • Loading branch information
svenkreiss authored Sep 8, 2017
2 parents a7128be + 9dc6c01 commit 48f14dc
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 12 deletions.
5 changes: 4 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ Changelog

Install a particular version, for example ``0.1.14``, with ``pip install html5validator==0.1.14``.

* `master <https://github.com/svenkreiss/html5validator/compare/v0.2.7...master>`_
* `master <https://github.com/svenkreiss/html5validator/compare/v0.2.8...master>`_
* `0.2.8 <https://github.com/svenkreiss/html5validator/compare/v0.2.7...v0.2.8>`_ (2017-09-08)
* update vnu jar to 17.9.0
* suppress a warning from the JDK about picked up environment variables
* `0.2.7 <https://github.com/svenkreiss/html5validator/compare/v0.2.5...v0.2.7>`_ (2017-04-09)
* update vnu jar to 17.3.0
* lint Python code
Expand Down
2 changes: 1 addition & 1 deletion html5validator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Validate HTML5 files."""
# flake8: noqa

__version__ = "0.2.7"
__version__ = "0.2.8"

from .validator import Validator, JavaNotFoundException
21 changes: 12 additions & 9 deletions html5validator/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

LOGGER = logging.getLogger(__name__)

DEFAULT_IGNORE_RE = ['Picked up _JAVA_OPTIONS:.*']


class JavaNotFoundException(Exception):
def __str__(self):
Expand All @@ -30,16 +32,17 @@ def __init__(self, directory='.', match='*.html', blacklist=None,
self.ignore = ignore if ignore else []
self.ignore_re = ignore_re if ignore_re else []

# add default ignore_re
self.ignore_re += DEFAULT_IGNORE_RE

# process fancy quotes in ignore
self.ignore = [self._normalize_string(s) for s in self.ignore]
self.ignore_re = [self._normalize_string(s) for s in self.ignore_re]

# Determine jar location.
self.vnu_jar_location = vnujar.__file__.replace(
'__init__.pyc', 'vnu.jar'
).replace(
'__init__.py', 'vnu.jar'
)
self.vnu_jar_location = (vnujar.__file__
.replace('__init__.pyc', 'vnu.jar')
.replace('__init__.py', 'vnu.jar'))
if sys.platform == 'cygwin':
self.vnu_jar_location = self._cygwin_path_convert(
self.vnu_jar_location)
Expand Down Expand Up @@ -92,10 +95,10 @@ def validate(self, files=None, errors_only=True, stack_size=None):
raise JavaNotFoundException()

try:
o = subprocess.check_output(['java', '-jar',
self.vnu_jar_location] + opts + files,
stderr=subprocess.STDOUT,
).decode('utf-8')
o = subprocess.check_output(
['java', '-jar', self.vnu_jar_location] + opts + files,
stderr=subprocess.STDOUT,
).decode('utf-8')
except subprocess.CalledProcessError as e:
o = e.output.decode('utf-8')

Expand Down
31 changes: 31 additions & 0 deletions vnujar/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,37 @@ With a few exceptions, this is a record of mainly just user-facing
changes—that is, either changes to the actual behavior of the checker, or
changes to any options/interfaces the checker exposes for developers.

# 17.9.0
20 August 2017
- Allow script[nomodule]
- Allow the hover, any-hover, pointer, and any-pointer media features
- Allow @scope, @updateviacache, @workertype for link[rel=serviceworker]
- Allow `&;` (don’t report it as “`&` did not start a character reference”)
- Add `acceptlanguage` query parameter, to specify an Accept-Language
request-header value for checker to send when fetching remote documents
- Update CSP checking to Salvation 2.3.0
https://github.com/shapesecurity/salvation/releases/tag/v2.3.0

# 17.7.0
26 June 2017
- Add new major feature to filter out (drop/ignore/suppress) errors/warnings
by regex. See https://github.com/validator/validator/wiki/Message-filtering
- Replace a case of “Attribute "foo" not allowed on element "param" **in this
context**” wording in error message with “Attribute "foo" not allowed on
element "param" **at this point**” (for consistent working for that error
between the command-line checker and the web-based checker).
- Disallow the "contextmenu" attribute and type=contextmenu and type=toolbar
for the `menu` element.
- Allow link[rel=serviceworker]
- Allow floating-point numbers in attribute values to start with decimal point
- Allow a[href] in SVG wherever a[xlink:href] is allowed
- Allow the "focusable" and "tabindex" attributes on SVG elements
- Fix bug that disallowed `progress` & `meter` as label[for] targets
- Default to text/html for checking file uploads
- Emit warnings for use of rel={copyright,previous}
- Prevent Bulgarian ➡ Russian misidentifications in language detector
- Skip figcaption elements when running the language detector

# 17.3.0
26 March 2017
- Allow “color” attribute with link[rel="mask-icon"]
Expand Down
19 changes: 18 additions & 1 deletion vnujar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ Use the `vnu.jar` HTML checker as an executable for command-line checking of
documents by invoking it like this:

java -jar ~/vnu.jar [--errors-only] [--exit-zero-always]
[--asciiquotes] [--no-stream] [--format gnu|xml|json|text] [--html]
[--asciiquotes] [--no-stream] [--format gnu|xml|json|text]
[--filterfile FILENAME] [--filterpattern PATTERN] [--html]
[--skip-non-html] [--no-langdetect] [--help] [--verbose] [--version]
FILES

Expand Down Expand Up @@ -127,6 +128,22 @@ executable provides the following options:

default: [unset; checker exits 1 if errors are reported for any documents]

#### --filterfile _FILENAME_

Specifies a filename. Each line of the file contains either a regular
expression or starts with "#" to indicate the line is a comment. Any error
message or warning message that matches a regular expression in the file is
filtered out (dropped/suppressed).

default: [unset; checker does no message filtering]

#### --filterpattern _PATTERN_

Specifies a regular-expression pattern. Any error message or warning message
that matches the pattern is filtered out (dropped/suppressed).

default: [unset; checker does no message filtering]

#### --format _format_

Specifies the output format for reporting the results.
Expand Down
19 changes: 19 additions & 0 deletions vnujar/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ <h2>Usage</h2>
<pre>
java -jar ~/vnu.jar [--errors-only] [--exit-zero-always]
[--asciiquotes] [--no-stream] [--format gnu|xml|json|text]
[--filterfile FILENAME] [--filterpattern PATTERN]
[--html] [--skip-non-html] [--no-langdetect]
[--help] [--verbose] [--version] FILES
</pre>
Expand Down Expand Up @@ -273,6 +274,24 @@ <h4 id="exit-zero-always">--exit-zero-always</h4>
default: [unset; checker exits 1 if errors are reported for any documents]
</pre>

<h4 id="filterfile">--filterfile <var>FILENAME</var></h4>
<pre>
Specifies a filename. Each line of the file contains either a regular
expression or starts with "#" to indicate the line is a comment. Any error
message or warning message that matches a regular expression in the file is
filtered out (dropped/suppressed).

default: [unset; checker does no message filtering]
</pre>

<h4 id="filterpattern">--filterpattern <var>PATTERN</var></h4>
<pre>
Specifies a regular-expression pattern. Any error message or warning
message that matches the pattern is filtered out (dropped/suppressed).

default: [unset; checker does no message filtering]
</pre>

<h4 id="format">--format <var>format</var></h4>
<pre>
Specifies the output format for reporting the results.
Expand Down
Binary file modified vnujar/vnu.jar
Binary file not shown.

0 comments on commit 48f14dc

Please sign in to comment.