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

Separate pp #1509

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion lib/profiles/TR.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ let rules = profileUtil.insertAfter(base, 'headers.w3c-state', [
rules = profileUtil.insertAfter(rules, 'sotd.supersedable', [
require('../rules/sotd/stability'),
require('../rules/sotd/publish'),
require('../rules/sotd/pp'),
require('../rules/sotd/charter'),
require('../rules/sotd/process-document'),
]);
Expand Down
3 changes: 2 additions & 1 deletion lib/profiles/TR/Note/note-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ exports.config = {
const base = require('../../TR');
const profileUtil = require('../../profileUtil');

const rules = profileUtil.insertAfter(base.rules, 'sotd.pp', [
const rules = profileUtil.insertAfter(base.rules, 'sotd.supersedable', [
require('../../../rules/sotd/deliverer-note'),
require('../../../rules/sotd/pp-not-apply'),
]);

exports.rules = rules;
1 change: 1 addition & 0 deletions lib/profiles/TR/Recommendation/recommendation-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const profileUtil = require('../../profileUtil');
const rules = profileUtil.insertAfter(base.rules, 'sotd.supersedable', [
require('../../../rules/sotd/diff'),
require('../../../rules/structure/security-privacy'),
require('../../../rules/sotd/pp'),
]);

exports.rules = rules;
8 changes: 7 additions & 1 deletion lib/profiles/TR/Registry/registry-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ exports.config = {

const base = require('../../TR');

exports.rules = base.rules;
const profileUtil = require('../../profileUtil');

const rules = profileUtil.insertAfter(base.rules, 'sotd.supersedable', [
require('../../../rules/sotd/pp-not-apply'),
]);

exports.rules = rules;
40 changes: 40 additions & 0 deletions lib/rules/sotd/pp-not-apply.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const self = {
name: 'sotd.pp-not-apply',
section: 'document-status',
rule: 'ppNotApplies',
};
exports.name = self.name;

exports.check = async function (sr, done) {
const wanted =
/The( 15 September 2020)? W3C Patent Policy does not carry any licensing requirements or commitments on this document./;

const sotd = sr.getSotDSection();
const candidates = sotd.querySelectorAll('p');

const ppFound = Array.prototype.filter.call(candidates, p =>
wanted.test(sr.norm(p.textContent))
);

if (!ppFound.length) {
return sr.error(self, 'no-pp-paragraph', { wanted });
}

const linkFound = Array.prototype.filter.call(
ppFound[0].querySelectorAll('a[href]'),
a => /W3C Patent Policy/.test(sr.norm(a.textContent))
);

if (!linkFound.length) {
return sr.error(self, 'no-pp-text', { wanted: 'W3C Patent Policy' });
}

const href = linkFound[0].getAttribute('href');
const ppLink = 'https://www.w3.org/Consortium/Patent-Policy/';
const pp2020 = 'https://www.w3.org/Consortium/Patent-Policy-20200915/';

if (!href || href !== ppLink || href !== pp2020)
return sr.error(self, 'no-pp-link', { ppLink, pp2020 });

return done();
};
8 changes: 1 addition & 7 deletions lib/rules/sotd/pp.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ function buildWanted(groups, sr, ppLink) {
let wanted;
const result = {};
const isPP2017 = ppLink === pp2017;
const isRecTrack = config.track === 'Recommendation';

let ppText = '( 15 September 2020)?';
if (isPP2017) ppText = ' 1 August 2017';
Expand All @@ -29,7 +28,6 @@ function buildWanted(groups, sr, ppLink) {
groups.length === 2 ? 'groups ' : 'a group '
}operating under the${ppText} W3C Patent Policy\\. ?`;

if (isRecTrack) {
wanted += ' W3C maintains ';
if (groups.length < 2) {
wanted += 'a public list of any patent disclosures';
Expand All @@ -54,10 +52,7 @@ function buildWanted(groups, sr, ppLink) {
' An individual who has actual knowledge of a patent which the individual ' +
'believes contains Essential Claim\\(s\\) must disclose the information in ' +
'accordance with section 6 of the W3C Patent Policy\\.';
} else {
// For documents not on REC-track, the sentence is different.
wanted = `The${ppText} W3C Patent Policy does not carry any licensing requirements or commitments on this document.`;
}

result.regex = new RegExp(wanted);
result.text = wanted.replace(/\\/g, '');
return result;
Expand Down Expand Up @@ -154,7 +149,6 @@ exports.check = async function (sr, done) {
sr.error(self, 'undefined');
return done();
}

const { pp, expected } = findPP(
util.filter(sotd, 'p').concat(...sotd.querySelectorAll('p')),
sr,
Expand Down