From ae25ad78906179e1448ff7d97957810e2be40206 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 7 Apr 2022 12:17:38 +1000 Subject: nop whitespace formatting change. - ran eglot-format using typescript-language-server on all js files in the repo except those under /hash_script/ - verify only whitespace changed: git diff --word-diff-regex=. 62d6a71 62d6a71~1 --- legacy_license_check.js | 110 ++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 55 deletions(-) (limited to 'legacy_license_check.js') diff --git a/legacy_license_check.js b/legacy_license_check.js index 5068085..59097ab 100644 --- a/legacy_license_check.js +++ b/legacy_license_check.js @@ -33,26 +33,26 @@ var licStartLicEndRe = /@licstartThefollowingistheentirelicensenoticefortheJavaS * hardcoded in license_definitions.js * */ -var stripLicenseToRegexp = function (license) { - var max = license.licenseFragments.length; - var item; - for (var i = 0; i < max; i++) { - item = license.licenseFragments[i]; - item.regex = match_utils.removeNonalpha(item.text); - item.regex = new RegExp( - match_utils.replaceTokens(item.regex), ''); - } - return license; +var stripLicenseToRegexp = function(license) { + var max = license.licenseFragments.length; + var item; + for (var i = 0; i < max; i++) { + item = license.licenseFragments[i]; + item.regex = match_utils.removeNonalpha(item.text); + item.regex = new RegExp( + match_utils.replaceTokens(item.regex), ''); + } + return license; }; -var license_regexes = []; +var license_regexes = []; -var init = function(){ - console.log("initializing regexes"); - for (var item in data.licenses) { - license_regexes.push(stripLicenseToRegexp(data.licenses[item])); - } - //console.log(license_regexes); +var init = function() { + console.log("initializing regexes"); + for (var item in data.licenses) { + license_regexes.push(stripLicenseToRegexp(data.licenses[item])); + } + //console.log(license_regexes); } module.exports.init = init; @@ -62,25 +62,25 @@ module.exports.init = init; * Takes in the declaration that has been preprocessed and * tests it against regexes in our table. */ -var search_table = function(stripped_comment){ - var stripped = match_utils.removeNonalpha(stripped_comment); - //stripped = stripped.replaceTokens(stripped_comment); - - //console.log("Looking up license"); - //console.log(stripped); - - for (license in data.licenses) { - frag = data.licenses[license].licenseFragments; - max_i = data.licenses[license].licenseFragments.length; - for (i = 0; i < max_i; i++) { - if (frag[i].regex.test(stripped)) { - //console.log(data.licenses[license].licenseName); - return data.licenses[license].licenseName; - } - } - } - console.log("No global license found."); - return false; +var search_table = function(stripped_comment) { + var stripped = match_utils.removeNonalpha(stripped_comment); + //stripped = stripped.replaceTokens(stripped_comment); + + //console.log("Looking up license"); + //console.log(stripped); + + for (license in data.licenses) { + frag = data.licenses[license].licenseFragments; + max_i = data.licenses[license].licenseFragments.length; + for (i = 0; i < max_i; i++) { + if (frag[i].regex.test(stripped)) { + //console.log(data.licenses[license].licenseName); + return data.licenses[license].licenseName; + } + } + } + console.log("No global license found."); + return false; } @@ -88,25 +88,25 @@ var search_table = function(stripped_comment){ * Takes the "first comment available on the page" * returns true for "free" and false for anything else */ -var check = function(license_text){ - //console.log("checking..."); - //console.log(license_text); - - if(license_text === undefined || license_text === null || license_text == ""){ - //console.log("Was not an inline script"); - return false; - } - // remove whitespace - var stripped = match_utils.removeWhitespace(license_text); - // Search for @licstart/@licend - // This assumes that there isn't anything before the comment - var matches = stripped.match(licStartLicEndRe); - if(matches == null){ - return false; - } - var declaration = matches[0]; - - return search_table(declaration); +var check = function(license_text) { + //console.log("checking..."); + //console.log(license_text); + + if (license_text === undefined || license_text === null || license_text == "") { + //console.log("Was not an inline script"); + return false; + } + // remove whitespace + var stripped = match_utils.removeWhitespace(license_text); + // Search for @licstart/@licend + // This assumes that there isn't anything before the comment + var matches = stripped.match(licStartLicEndRe); + if (matches == null) { + return false; + } + var declaration = matches[0]; + + return search_table(declaration); }; -- cgit v1.2.3