Skip to content
This repository was archived by the owner on Jan 14, 2022. It is now read-only.

Commit 57780c8

Browse files
author
Lucas Rojas
committed
Clean comments in manifestValidator.js
1 parent d615ba6 commit 57780c8

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

lib/manifestTools/manifestValidator.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,24 @@ var constants = require('../constants'),
1212

1313
var toStringFunction = Object.prototype.toString;
1414

15-
// load the rule(s) from a folder or file
1615
function loadValidationRules(fileOrDir, platforms, callback) {
1716

1817
var stat = Q.nfbind(fs.stat);
1918

20-
// list contents of the validation rules folder
2119
return Q.nfcall(fs.readdir, fileOrDir).then(function (files) {
2220
return Q.allSettled(files.map(function (file) {
2321
var filePath = path.join(fileOrDir, file);
2422
return stat(filePath).then(function (info) {
25-
// test if file system object is a directory or a file
2623
if (info.isDirectory()) {
27-
// ignore any directory that doesn't match one of the requested platforms
2824
if (platforms.indexOf(file) < 0) {
2925
return Q.resolve();
3026
}
3127

32-
// process the rules in the platform folder
3328
return loadValidationRules(filePath, []);
3429
}
3530

36-
// load the rules defined in the file
3731
var rulePath = path.join(fileOrDir, file);
3832
try {
39-
// load the rule from the file
4033
return require(rulePath);
4134
}
4235
catch (err) {
@@ -45,7 +38,6 @@ function loadValidationRules(fileOrDir, platforms, callback) {
4538
});
4639
}))
4740
.then (function (results) {
48-
// verify the results and consolidate the loaded rules
4941
return results.reduce(function (validationRules, result) {
5042
if (result.state === 'fulfilled') {
5143
if (result.value) {
@@ -70,7 +62,6 @@ function loadValidationRules(fileOrDir, platforms, callback) {
7062
throw err;
7163
}
7264

73-
// fileOrDir is a file
7465
var rules = require(fileOrDir);
7566
return Array.isArray(rules) ? rules : [rules];
7667
})
@@ -114,7 +105,6 @@ function applyValidationRules(w3cManifestInfo, platformModules, platforms) {
114105
var allResults = [];
115106

116107
function validateAllPlatforms() {
117-
// load and run validation rules for "all platforms"
118108
var validationRulesDir = path.join(__dirname, 'validationRules');
119109
return loadValidationRules(validationRulesDir).then(function (rules) {
120110
return runValidationRules(w3cManifestInfo, rules).then(function (results) {
@@ -124,7 +114,6 @@ function applyValidationRules(w3cManifestInfo, platformModules, platforms) {
124114
}
125115

126116
function validatePlatform() {
127-
// run platform-specific validation rules
128117
var platformTasks = platformModules.map(function (platform) {
129118
return platform.getValidationRules(platforms).then(function (rules) {
130119
return runValidationRules(w3cManifestInfo, rules).then(function (results) {
@@ -136,7 +125,6 @@ function applyValidationRules(w3cManifestInfo, platformModules, platforms) {
136125
return Q.allSettled(platformTasks);
137126
}
138127

139-
// Only run the "All Platform" validations for W3C manifests
140128
if (w3cManifestInfo.format === constants.BASE_MANIFEST_FORMAT) {
141129
return validateAllPlatforms()
142130
.then(validatePlatform)
@@ -256,7 +244,6 @@ function validateAndNormalizeStartUrl(siteUrl, manifestInfo, callback) {
256244
var parsedSiteUrl = url.parse(siteUrl);
257245
var parsedManifestStartUrl = url.parse(manifestInfo.content.start_url);
258246
if (parsedManifestStartUrl.hostname && parsedSiteUrl.hostname !== parsedManifestStartUrl.hostname) {
259-
// issue #88 - bis
260247
var subDomainOfManifestStartUrlSplitted = parsedManifestStartUrl.hostname.split('.');
261248
var lengthSubDomain = subDomainOfManifestStartUrlSplitted.length;
262249
var subDomainOfManifestStartUrl = null;

0 commit comments

Comments
 (0)