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

downgrade a few fval checks from FAIL to WARN #1975

Merged
merged 1 commit into from
Jul 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions Lib/fontbakery/specifications/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,21 @@ def com_google_fonts_check_036(font):
)
def com_google_fonts_check_037(font):
"""Checking with Microsoft Font Validator."""

# In some cases we want to override the severity level of
# certain checks in FontValidator:
downgrade_to_warn = [
"The xAvgCharWidth field does not equal the calculated value",
"There are undefined bits set in fsSelection field",
"Misoriented contour"
]

# Some other checks we want to completely disable:
disabled_fval_checks = [
"Validating glyph with index",
"Table Test:"
]

try:
import subprocess
fval_cmd = [
Expand All @@ -155,10 +170,9 @@ def com_google_fonts_check_037(font):
except subprocess.CalledProcessError as e:
filtered_msgs = ""
for line in e.output.decode().split("\n"):
if "Validating glyph with index" in line:
continue
if "Table Test:" in line:
continue
for substring in disabled_fval_checks:
if substring in line:
continue
filtered_msgs += line + "\n"
yield INFO, ("Microsoft Font Validator returned an error code."
" Output follows :\n\n{}\n").format(filtered_msgs)
Expand Down Expand Up @@ -191,7 +205,11 @@ def report_message(msg, details):
if report.get("ErrorType") == "P":
yield PASS, report_message(msg, details)
elif report.get("ErrorType") == "E":
yield FAIL, report_message(msg, details)
status = FAIL
for substring in downgrade_to_warn:
if substring in msg:
status = WARN
yield status, report_message(msg, details)
elif report.get("ErrorType") == "W":
yield WARN, report_message(msg, details)
else:
Expand Down