Skip to content

Commit

Permalink
A few more little fixes, and rebase tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tabatkins committed Aug 23, 2024
1 parent 8035e8b commit 173e7df
Show file tree
Hide file tree
Showing 90 changed files with 376 additions and 9,505 deletions.
4 changes: 4 additions & 0 deletions bikeshed/Spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,17 @@ def initMetadata(self, inputContent: InputSource.InputContent) -> None:
# Combine the data so far, and compute the doctype
# (the other md sources need the doctype in order to be found)
self.md = metadata.join(self.mdBaseline, self.mdDocument, self.mdCommandLine)
rawDoctype = (self.md.rawOrg, self.md.rawGroup, self.md.rawStatus)
self.doctype = self.doctypes.getDoctype(self.md.rawOrg, self.md.rawGroup, self.md.rawStatus)

self.mdDefaults = metadata.fromJson(
data=retrieve.retrieveBoilerplateFile(self, "defaults"),
source="defaults",
)
self.md = metadata.join(self.mdBaseline, self.mdDefaults, self.mdDocument, self.mdCommandLine)
if rawDoctype != (self.md.rawOrg, self.md.rawGroup, self.md.rawStatus):
# recompute doctype
self.doctype = self.doctypes.getDoctype(self.md.rawOrg, self.md.rawGroup, self.md.rawStatus)

# Using all of that, load up the text macros so I can sub them into the computed-metadata file.
self.md.fillTextMacros(self.macros, doc=self)
Expand Down
2 changes: 1 addition & 1 deletion bikeshed/doctypes/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def looselyMatch(self, rawStatus: str) -> bool:
orgName, statusName = utils.splitOrg(rawStatus)
if statusName and self.name.upper() != statusName.upper():
return False
if orgName and self.org.name != orgName.lower():
if orgName and self.org.name != orgName.upper():
return False
return True

Expand Down
8 changes: 3 additions & 5 deletions bikeshed/doctypes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def canonicalize(
f"Your Group ({group.name}) is in the '{group.org.name}' Org, but your Status ({status.name}) is only usable in the '{status.org.name}' Org. Allowed Status values for '{group.org.name}' are {config.englishFromList(sorted(possibleStatusNames))}",
)

if group and group.type is not None and status and status.groupTypes and group.type not in status.groupTypes:
if group and group.type is not None and status and status.groupTypes and group.type not in status.groupTypes:
allowedStatuses = [s.name for s in group.org.statuses.values() if group.type in s.groupTypes]
if allowedStatuses:
m.warn(
Expand All @@ -115,7 +115,7 @@ def canonicalize(

if group and status and group.org.name == "W3C":
# Apply the special w3c rules
validateW3CStatus(group, status)
validateW3CStatus(status)

# Reconciliation done, return everything if Status exists.
if status:
Expand Down Expand Up @@ -200,13 +200,11 @@ def reconcileOrgs(fromRaw: str | None, fromStatus: str | None, fromGroup: str |
return orgName


def validateW3CStatus(group: Group, status: Status) -> None:
def validateW3CStatus(status: Status) -> None:
if status.name == "DREAM":
m.warn("You used Status:DREAM for a W3C document. Consider Status:UD instead.")

if status.name in ("IG-NOTE", "WG-NOTE"):
m.die(
f"Under Process2021, {status.name} is no longer a valid status. Use NOTE (or one of its variants NOTE-ED, NOTE-FPWD, NOTE-WD) instead.",
)


6 changes: 3 additions & 3 deletions bikeshed/headings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def processHeadings(doc: t.SpecT, scope: str = "doc") -> None:
for el in headings:
h.addClass(doc, el, "settled")
if scope == "all" and doc.doctype.group.privSec:
checkPrivacySecurityHeadings(h.findAll(".heading", doc))
checkPrivacySecurityHeadings(doc, h.findAll(".heading", doc))


def resetHeadings(headings: list[t.ElementT]) -> None:
Expand Down Expand Up @@ -56,7 +56,7 @@ def addHeadingIds(doc: t.SpecT, headings: list[t.ElementT]) -> None:
)


def checkPrivacySecurityHeadings(headings: list[t.ElementT]) -> None:
def checkPrivacySecurityHeadings(doc: t.SpecT, headings: list[t.ElementT]) -> None:
security = False
privacy = False
for header in headings:
Expand All @@ -66,7 +66,7 @@ def checkPrivacySecurityHeadings(headings: list[t.ElementT]) -> None:
security = True
if "privacy" in text and "considerations" in text:
privacy = True
if "security" in text and "privacy" in text and "considerations" in text:
if "security" in text and "privacy" in text and "considerations" in text and doc.doctype.org.name == "W3C":
m.warn(
"W3C policy requires Privacy Considerations and Security Considerations to be separate sections, but you appear to have them combined into one.",
el=header,
Expand Down
4 changes: 3 additions & 1 deletion bikeshed/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,10 @@ def fillTextMacros(self, macros: t.DefaultDict[str, str], doc: t.SpecT) -> None:
macros["level"] = str(self.level)
if self.displayVshortname:
macros["vshortname"] = self.displayVshortname
if doc.doctype.status.fullName() == "FINDING" and doc.doctype.group:
if doc.doctype.status.name == "FINDING" and doc.doctype.group:
macros["longstatus"] = f"Finding of the {doc.doctype.group.name}"
elif doc.doctype.status.name == "DRAFT-FINDING" and doc.doctype.group:
macros["longstatus"] = f"Draft Finding of the {doc.doctype.group.name}"
elif doc.doctype.status:
macros["longstatus"] = doc.doctype.status.longName
else:
Expand Down
8 changes: 5 additions & 3 deletions bikeshed/spec-data/readonly/boilerplate/doctypes.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ status "LS-COMMIT" "Commit Snapshot"
status "LS-BRANCH" "Branch Snapshot"
status "LS-PR" "PR Preview"
status "LD" "Living Document"
status "DRAFT-FINDING" "Draft Finding"
status "FINDING" "Finding"

org "whatwg" {
group "whatwg" priv-sec=true
group "whatwg" priv-sec=false
status "RD" "Review Draft" {
requires "Date"
}
Expand Down Expand Up @@ -126,7 +128,7 @@ org "w3c" {
group "webml" type="cg"
group "webmlwg" type="wg"
group "webperf" type="wg"
group "webplatform" type="cg" priv-sec=true
group "webplatform" type="wg" priv-sec=true
group "webrtc" type="wg"
group "webspecs" type="wg" priv-sec=true
group "webtransport" type="wg"
Expand Down Expand Up @@ -162,7 +164,7 @@ org "w3c" {
group-types "wg"
}
status "CR" "W3C Candidate Recommendation Snapshot" {
requires "Level" "ED" "TR" "Issue Tracking" "Date" "Implentation Report"
requires "Level" "ED" "TR" "Issue Tracking" "Date" "Implementation Report"
group-types "wg"
}
status "CRD" "W3C Candidate Recommendation Draft" {
Expand Down
2 changes: 1 addition & 1 deletion tests/github/WICG/container-queries/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
<title>Container Queries</title>
<meta content="CG-Draft" name="w3c-status">
<meta content="CG-DRAFT" name="w3c-status">
<link href="https://www.w3.org/StyleSheets/TR/2021/cg-draft" rel="stylesheet">
<link href="https://www.w3.org/2008/site/images/favicon.ico" rel="icon">
<link href="https://github.com/ResponsiveImagesCG/container-queries" rel="canonical">
Expand Down
2 changes: 1 addition & 1 deletion tests/github/WICG/content-index/spec/index.console.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WARNING: You used Status: ED, but W3C Community and Business Groups are limited to these statuses: CG-DRAFT, CG-FINAL, UD.
WARNING: You used Status ED, but your Group (WICG) is limited to the statuses CG-DRAFT, CG-FINAL, or UD.
LINE ~76: Multiple possible 'service worker' dfn refs.
Arbitrarily chose https://w3c.github.io/ServiceWorker/#dfn-service-worker
To auto-select one of the following refs, insert one of these lines into a <pre class=link-defaults> block:
Expand Down
2 changes: 1 addition & 1 deletion tests/github/WICG/cq-usecases/index.console.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WARNING: You used Status: ED, but W3C Community and Business Groups are limited to these statuses: CG-DRAFT, CG-FINAL, UD.
WARNING: You used Status ED, but your Group (WICG) is limited to the statuses CG-DRAFT, CG-FINAL, or UD.
LINT: Your document appears to use spaces to indent, but line 48 starts with tabs.
LINT: Your document appears to use spaces to indent, but line 49 starts with tabs.
LINT: Your document appears to use spaces to indent, but line 55 starts with tabs.
Expand Down
1 change: 1 addition & 0 deletions tests/github/WICG/css-parser-api/index.console.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
WARNING: This specification has neither a 'Security Considerations' nor a 'Privacy Considerations' section. Please consider adding both, see https://w3ctag.github.io/security-questionnaire/.
1 change: 1 addition & 0 deletions tests/github/WICG/keyboard-lock/index.console.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
WARNING: You used Status CG-DRAFT, but your Group (WEBPLATFORM) is limited to the statuses CR, CRD, CRY, CRYD, DRAFT-FINDING, DRY, ED, FINDING, FPWD, LCWD, LS, MO, NOTE, NOTE-ED, NOTE-FPWD, NOTE-WD, PER, PR, REC, RY, UD, WD, or WG-NOTE.
LINT: Your document appears to use tabs to indent, but line 40 starts with spaces.
LINT: Your document appears to use tabs to indent, but line 41 starts with spaces.
LINT: Your document appears to use tabs to indent, but line 54 starts with spaces.
Expand Down
2 changes: 1 addition & 1 deletion tests/github/immersive-web/lighting-estimation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
<title>WebXR Lighting Estimation API Level 1</title>
<meta content="w3c/ED" name="w3c-status">
<meta content="ED" name="w3c-status">
<link href="https://www.w3.org/StyleSheets/TR/2021/W3C-ED" rel="stylesheet">
<link href="https://www.w3.org/2008/site/images/favicon.ico" rel="icon">
<meta content="dark light" name="color-scheme">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
WARNING: You used Status: DREAM for a W3C document. Consider UD instead.
WARNING: You used Status:DREAM for a W3C document. Consider Status:UD instead.
LINE 259: Multiple elements have the same ID 'dom-xrframe-metadata'.
Deduping, but this ID may not be stable across revisions.
LINK ERROR: No 'idl-name' refs found for 'XRFeatureInit'.
Expand Down
Loading

0 comments on commit 173e7df

Please sign in to comment.