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

Simplify PASS results - assume all is fine if nothing is yielded #4614

Merged
merged 46 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
98f3b03
Assume all is fine when no SubResult is yielded
felipesanches Mar 26, 2024
67da3aa
simplify PASS results - adobefonts profile
felipesanches Mar 26, 2024
74430e7
simplify PASS results - fontbureau profile
felipesanches Mar 26, 2024
9d8491d
simplify PASS results - fontwerk profile
felipesanches Mar 26, 2024
62e220d
simplify PASS results - googlefonts profile (article)
felipesanches Mar 26, 2024
66aae0f
simplify PASS results - googlefonts profile (axisregistry)
felipesanches Mar 26, 2024
5432d57
simplify PASS results - googlefonts profile (color)
felipesanches Mar 26, 2024
594fa19
simplify PASS results - googlefonts profile (copyright)
felipesanches Mar 26, 2024
0b8cb3e
simplify PASS results - googlefonts profile (description)
felipesanches Mar 26, 2024
b390f11
simplify PASS results - googlefonts profile (family)
felipesanches Mar 26, 2024
0b26229
simplify PASS results - googlefonts profile (gdef)
felipesanches Mar 26, 2024
7be3ecf
simplify PASS results - googlefonts profile (glyf)
felipesanches Mar 26, 2024
84ba52b
simplify PASS results - googlefonts profile (glyphset)
felipesanches Mar 27, 2024
d5d2d8f
simplify PASS results - googlefonts profile (gpos)
felipesanches Mar 27, 2024
9e2b35b
simplify PASS results - googlefonts profile (gsub)
felipesanches Mar 27, 2024
bc2d7cc
simplify PASS results - googlefonts profile (head)
felipesanches Mar 27, 2024
da048ee
simplify PASS results - googlefonts profile (hinting)
felipesanches Mar 27, 2024
523084f
simplify PASS results - googlefonts profile (hosted)
felipesanches Mar 27, 2024
76ef06c
simplify PASS results - googlefonts profile (license)
felipesanches Mar 27, 2024
80c18f5
simplify PASS results - googlefonts profile (metadata)
felipesanches Mar 26, 2024
a3d18b2
simplify PASS results - googlefonts profile (name)
felipesanches Mar 27, 2024
c9d80a1
simplify PASS results - googlefonts profile (os2)
felipesanches Mar 27, 2024
39bee3f
simplify PASS results - googlefonts profile (repo)
felipesanches Mar 27, 2024
48f7c89
simplify PASS results - googlefonts profile (subsets)
felipesanches Mar 27, 2024
bde458b
simplify PASS results - googlefonts profile (tables)
felipesanches Mar 27, 2024
cee6569
simplify PASS results - googlefonts profile (varfont)
felipesanches Mar 27, 2024
4a4db73
simplify PASS results - googlefonts profile (vmetrics)
felipesanches Mar 27, 2024
a848d30
simplify PASS results - iso15008 profile
felipesanches Mar 27, 2024
030c4b0
simplify PASS results - notofonts profile
felipesanches Mar 27, 2024
78496dd
simplify PASS results - opentype profile (cff)
felipesanches Mar 27, 2024
4f10100
simplify PASS results - opentype profile (dsig)
felipesanches Mar 27, 2024
5c7b089
simplify PASS results - opentype profile (fvar)
felipesanches Mar 27, 2024
e90da3d
simplify PASS results - opentype profile (gdef)
felipesanches Mar 27, 2024
304f1e2
simplify PASS results - opentype profile (glyf)
felipesanches Mar 27, 2024
7cf8ac5
simplify PASS results - opentype profile (gpos)
felipesanches Mar 27, 2024
496bcae
simplify PASS results - opentype profile (head)
felipesanches Mar 27, 2024
5cd90d7
simplify PASS results - opentype profile (hhea)
felipesanches Mar 27, 2024
cecaf68
simplify PASS results - opentype profile (kern)
felipesanches Mar 27, 2024
e314b2d
simplify PASS results - opentype profile (layout)
felipesanches Mar 27, 2024
7c715ad
simplify PASS results - opentype profile (loca)
felipesanches Mar 27, 2024
1448489
simplify PASS results - opentype profile (name)
felipesanches Mar 27, 2024
107417c
simplify PASS results - opentype profile (os2)
felipesanches Mar 27, 2024
a2fcc6d
simplify PASS results - opentype profile (stat)
felipesanches Mar 27, 2024
1aed5e2
simplify PASS results - ufo profile
felipesanches Mar 27, 2024
128fa7d
simplify PASS results - universal profile
felipesanches Mar 27, 2024
0533ace
we won't run code-tests on PASS messages anymore
felipesanches Mar 27, 2024
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
9 changes: 0 additions & 9 deletions Lib/fontbakery/checks/adobefonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ def com_adobe_fonts_check_family_consistent_upm(ttFonts):
"inconsistent-upem",
f"Fonts have different units per em: {sorted(upm_set)}.",
)
else:
yield PASS, "Fonts have consistent units per em."


def _quick_and_dirty_glyph_is_empty(font, glyph_name):
Expand Down Expand Up @@ -238,8 +236,6 @@ def com_adobe_fonts_check_unsupported_tables(ttFont):
"unsupported-tables",
f"The following unsupported font tables were found:\n\n{unsupported_list}",
)
else:
yield PASS, "No unsupported tables were found."


@check(
Expand All @@ -255,7 +251,6 @@ def com_adobe_fonts_check_unsupported_tables(ttFont):
)
def com_adobe_fonts_check_STAT_strings(ttFont):
"""Check correctness of STAT table strings"""
passed = True
stat_table = ttFont["STAT"].table
ital_slnt_axis_indices = []
for index, axis in enumerate(stat_table.DesignAxisRecord.Axis):
Expand All @@ -277,7 +272,6 @@ def com_adobe_fonts_check_STAT_strings(ttFont):
bad_values = set()
for name in ttFont["name"].names:
if name.nameID in nameIDs and "italic" in name.toUnicode().lower():
passed = False
bad_values.add(f"nameID {name.nameID}: {name.toUnicode()}")

if bad_values:
Expand All @@ -287,6 +281,3 @@ def com_adobe_fonts_check_STAT_strings(ttFont):
f' should not contain "Italic":\n'
f" {sorted(bad_values)}",
)

if passed:
yield PASS, "Looks good!"
6 changes: 1 addition & 5 deletions Lib/fontbakery/checks/fontbureau.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from fontbakery.prelude import check, FAIL, PASS, Message
from fontbakery.prelude import check, FAIL, Message


@check(
Expand All @@ -11,20 +11,16 @@
)
def io_github_abysstypeco_check_ytlc_sanity(ttFont):
"""Check if ytlc values are sane in vf"""
passed = True

for axis in ttFont["fvar"].axes:
if not axis.axisTag == "ytlc":
continue

if axis.minValue < 0 or axis.maxValue > 1000:
passed = False
yield FAIL, Message(
"invalid-range",
f"The range of ytlc values"
f" ({axis.minValue} - {axis.maxValue}) does not conform"
f" to the expected range of ytlc which"
f" should be min value 0 to max value 1000",
)
if passed:
yield PASS, "ytlc is sane"
30 changes: 1 addition & 29 deletions Lib/fontbakery/checks/fontwerk.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Checks for Fontwerk <https://fontwerk.com/>
"""

from fontbakery.prelude import check, PASS, FAIL, INFO, Message
from fontbakery.prelude import check, FAIL, INFO, Message
from fontbakery.constants import FsSelection, MacStyle


Expand All @@ -23,14 +23,9 @@
def com_fontwerk_check_name_no_mac_entries(ttFont):
"""Check if font has Mac name table entries (platform=1)"""

passed = True
for rec in ttFont["name"].names:
if rec.platformID == 1:
yield FAIL, Message("mac-names", f"Please remove name ID {rec.nameID}")
passed = False

if passed:
yield PASS, "No Mac name table entries."


@check(
Expand All @@ -48,8 +43,6 @@ def com_fontwerk_check_vendor_id(ttFont):
yield FAIL, Message(
"bad-vendor-id", f"OS/2 VendorID is '{vendor_id}', but should be 'WERK'."
)
else:
yield PASS, f"OS/2 VendorID '{vendor_id}' is correct."


@check(
Expand All @@ -65,7 +58,6 @@ def com_fontwerk_check_names_match_default_fvar(ttFont):
"""Checking if names match default fvar instance name."""
from fontbakery.constants import NameID

passed = True
default_axis_values = {
axis.axisTag: axis.defaultValue for axis in ttFont["fvar"].axes
}
Expand All @@ -76,7 +68,6 @@ def com_fontwerk_check_names_match_default_fvar(ttFont):
break

if default_name_id is None:
passed = False
yield FAIL, Message(
"missing-default-name-id", "fvar is missing a default instance name ID."
)
Expand All @@ -86,7 +77,6 @@ def com_fontwerk_check_names_match_default_fvar(ttFont):
subfam_name = ttFont["name"].getDebugName(default_name_id)

if subfam_name is None:
passed = False
yield FAIL, Message(
"missing-name-id",
f"Name ID {default_name_id} stored in"
Expand Down Expand Up @@ -118,27 +108,21 @@ def com_fontwerk_check_names_match_default_fvar(ttFont):
continue

if name_fam is None:
passed = False
yield FAIL, Message("missing-name-id", "Missing name ID {fam_id}.")
elif name_subfam is None:
passed = False
yield FAIL, Message("missing-name-id", "Missing name ID {subfam_id}.")
else:
possible_names = [f"{name_fam} {name_subfam}"]
if name_subfam.lower() == "regular":
possible_names.append(name_fam)

if default_name not in possible_names:
passed = False
yield FAIL, Message(
"bad-name",
f"Name {possible_names} does not match fvar"
f" default name '{default_name}'",
)

if passed:
yield PASS, f"Name matches fvar default name '{default_name}'."


@check(
id="com.fontwerk/check/weight_class_fvar",
Expand All @@ -165,9 +149,6 @@ def com_fontwerk_check_weight_class_fvar(ttFont):
f"but should match fvar default value '{fvar_value}'.",
)

else:
yield PASS, f"OS/2 usWeightClass '{os2_value}' matches fvar default value."


def is_covered_in_stat(ttFont, axis_tag, value):
if "STAT" not in ttFont:
Expand Down Expand Up @@ -219,7 +200,6 @@ def com_fontwerk_check_inconsistencies_between_fvar_stat(ttFont):
return FAIL, Message(
"missing-stat-table", "Missing STAT table in variable font."
)
passed = True
fvar = ttFont["fvar"]
name = ttFont["name"]

Expand All @@ -231,7 +211,6 @@ def com_fontwerk_check_inconsistencies_between_fvar_stat(ttFont):
f"The name ID {ins.subfamilyNameID} used in an"
f" fvar instance is missing in the name table.",
)
passed = False
continue

for axis_tag, value in ins.coordinates.items():
Expand All @@ -241,13 +220,9 @@ def com_fontwerk_check_inconsistencies_between_fvar_stat(ttFont):
f"{instance_name}: '{axis_tag}' axis value '{value}'"
f" missing in STAT table.",
)
passed = False

# TODO: Compare fvar instance name with constructed STAT table name.

if passed:
yield PASS, "STAT and fvar axis records are consistent."


@check(
id="com.fontwerk/check/style_linking",
Expand Down Expand Up @@ -286,8 +261,5 @@ def com_fontwerk_check_style_linking(ttFont, font):
name_id_2_should_be = "Bold Italic"
errs.append(f"name ID should be (most likely) '{name_id_2_should_be}'.")

if not errs:
yield PASS, "Style linking looks good."

for err in errs:
yield FAIL, Message("style-linking-issue", err)
10 changes: 1 addition & 9 deletions Lib/fontbakery/checks/googlefonts/article.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

from fontbakery.prelude import check, Message, PASS, FAIL, WARN
from fontbakery.prelude import check, Message, FAIL, WARN


@check(
Expand Down Expand Up @@ -39,11 +39,9 @@ def is_vector(filename):
return True
return False

passed = True
article_dir = os.path.join(family_directory, "article")
images_dir = os.path.join(family_directory, "article", "images")
if not os.path.isdir(article_dir):
passed = False
yield WARN, Message(
"lacks-article",
f"Family metadata at {family_directory} does not have an article.\n",
Expand All @@ -62,7 +60,6 @@ def is_vector(filename):
if is_vector(filename) or is_raster(filename)
]
if misplaced_files:
passed = False
yield WARN, Message(
"misplaced-image-files",
f"There are {len(misplaced_files)} image files in the `article`"
Expand All @@ -84,7 +81,6 @@ def is_vector(filename):

filesize = os.stat(filename).st_size
if filesize > maxsize:
passed = False
yield FAIL, Message(
"filesize",
f"`{filename}` has `{filesize} bytes`, but the maximum filesize"
Expand All @@ -98,12 +94,8 @@ def is_vector(filename):

w, h = dim
if w > MAX_WIDTH or h > MAX_HEIGHT:
passed = False
yield FAIL, Message(
"image-too-large",
f"Image is too large: `{w} x {h} pixels`\n\n"
f"Max resulution allowed: `{MAX_WIDTH} x {MAX_HEIGHT} pixels`",
)

if passed:
yield PASS, "All looks good!"
21 changes: 1 addition & 20 deletions Lib/fontbakery/checks/googlefonts/axisregistry.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from functools import lru_cache
from fontbakery.prelude import check, Message, INFO, PASS, FAIL
from fontbakery.prelude import check, Message, INFO, FAIL
from fontbakery.constants import PlatformID, WindowsEncodingID, WindowsLanguageID


Expand All @@ -22,15 +22,13 @@ def GFAxisRegistry():
)
def com_google_fonts_check_gf_axisregistry_bounds(family_metadata):
"""Validate METADATA.pb axes values are within gf_axisregistry bounds."""
passed = True
for axis in family_metadata.axes:
if axis.tag in GFAxisRegistry().keys():
expected = GFAxisRegistry()[axis.tag]
if (
axis.min_value < expected.min_value
or axis.max_value > expected.max_value
):
passed = False
yield FAIL, Message(
"bad-axis-range",
f"The range in the font variation axis"
Expand All @@ -40,8 +38,6 @@ def com_google_fonts_check_gf_axisregistry_bounds(family_metadata):
f" as defined on Google Fonts Axis Registry"
f" (min:{expected.min_value} max:{expected.max_value}).",
)
if passed:
yield PASS, "OK"


@check(
Expand Down Expand Up @@ -73,19 +69,14 @@ def com_google_fonts_check_gf_axisregistry_bounds(family_metadata):
)
def com_google_fonts_check_gf_axisregistry_valid_tags(family_metadata):
"""Validate METADATA.pb axes tags are defined in gf_axisregistry."""
passed = True
for axis in family_metadata.axes:
if axis.tag not in GFAxisRegistry().keys():
passed = False
yield FAIL, Message(
"bad-axis-tag",
f"The font variation axis '{axis.tag}'"
f" is not yet registered on Google Fonts Axis Registry.",
)

if passed:
yield PASS, "OK"


@check(
id="com.google.fonts/check/gf_axisregistry/fvar_axis_defaults",
Expand Down Expand Up @@ -116,13 +107,11 @@ def com_google_fonts_check_gf_axisregistry_fvar_axis_defaults(ttFont):
Validate defaults on fvar table match registered fallback names in GFAxisRegistry.
"""

passed = True
for axis in ttFont["fvar"].axes:
if axis.axisTag not in GFAxisRegistry():
continue
fallbacks = GFAxisRegistry()[axis.axisTag].fallback
if axis.defaultValue not in [f.value for f in fallbacks]:
passed = False
yield FAIL, Message(
"not-registered",
f"The defaul value {axis.axisTag}:{axis.defaultValue} is not registered"
Expand All @@ -131,8 +120,6 @@ def com_google_fonts_check_gf_axisregistry_fvar_axis_defaults(ttFont):
" or adopted one of the existing fallback names for this axis:\n"
f"\t{fallbacks}",
)
if passed:
yield PASS, "OK"


@check(
Expand All @@ -153,7 +140,6 @@ def com_google_fonts_check_STAT_gf_axisregistry_names(ttFont):
def normalize_name(name):
return "".join(name.split(" "))

passed = True
format4_entries = False
if "STAT" not in ttFont:
yield FAIL, "Font is missing STAT table."
Expand Down Expand Up @@ -210,7 +196,6 @@ def normalize_name(name):
is_value = axis_value.NominalValue
if name not in expected_names:
expected_names = ", ".join(expected_names)
passed = False
yield FAIL, Message(
"invalid-name",
f"On the font variation axis '{axis.AxisTag}',"
Expand All @@ -219,7 +204,6 @@ def normalize_name(name):
" to the Google Fonts Axis Registry.",
)
elif is_value != fallbacks[name_entry.toUnicode()]:
passed = False
yield FAIL, Message(
"bad-coordinate",
f"Axis Value for '{axis.AxisTag}':'{name_entry.toUnicode()}' is"
Expand All @@ -235,6 +219,3 @@ def normalize_name(name):
" which is what these 'format 4' entries are designed to describe,"
" so this check will ignore them for now.",
)

if passed:
yield PASS, "OK"
Loading
Loading