Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Warning whitelist doesn't work in Google closure compiler

The manual says I can use:

 --warnings_whitelist_file VAL          : A file containing warnings to
                                          suppress. Each line should be of the
                                          form
                                          <file-name>:<line-number>?  <warning-d
                                          escription>

This is what my whitelist looks like:

ef-utils.js:1  Redeclared variable: ef
ef-utils.js:1  Variable ef first declared in externs-ko.js
ef-validation.js:1  Redeclared variable: ef
ef-validation.js:1  Variable ef first declared in externs-ko.js

And I am still getting warnings while compiling:

ef-utils.js:1: WARNING - Redeclared variable: ef
?var ef = (function (ns, ko) {
     ^

ef-utils.js:1: WARNING - Variable ef first declared in externs-ko.js
?var ef = (function (ns, ko) {
     ^

ef-validation.js:1: WARNING - Redeclared variable: ef
?var ef = (function (ns, ko) {
     ^

ef-validation.js:1: WARNING - Variable ef first declared in externs-ko.js
?var ef = (function (ns, ko) {
     ^
like image 976
Trident D'Gao Avatar asked Oct 03 '22 10:10

Trident D'Gao


1 Answers

I just toyed around with the current WhitelistWarningsGuard. I found out that

  • Line numbers are completely ignored: they are stripped both from the input file and the encountered warnings.
  • File names are formatted as they are for output, i.e. as they occur on the command line.
  • There is a colon after the file name, followed by two spaces, followed by the message text without indicator of the severity (WARNING, ERROR).
  • The main effect of the whitelist appears to be turning errors into warnings. So when applied to warnings, there will be no effect at all.
  • The WhitelistBuilder mentioned by Tibos is there in the code, but I see no way to use it from the command line.

As it is, that feature appears to be mostly useless for my use cases…

like image 123
MvG Avatar answered Oct 07 '22 19:10

MvG