road to achieving 100% typing
Dear list readers, In WebODF we use JSLint and Closure Compiler to get good quality. We can improve the code quality in WebODF further by activating a new compile flag for Closure Compiler: --jscomp_error reportUnknownTypes This flag will abort the compilation if the type of a variable cannot be determined. If a type is unknown, the programmer can add it with a @type or @param annotation. There is no need to put these annotations everywhere. For many cases, the compiler can determine the type. Eventually, I would like all code to be compiled with this flag. That will not happen overnight (not at this latitude anyway). So we need a transition mechanism. Today, a patch landed in WebODF that gives us just that. The top level CMakeLists.txt files now divides the source .js files in three categories: a) 100% typed and depending only on 100% typed files b) not 100% typed but depending only on 100% typed files c) the rest. These categories are determined by a new tool: updateJS.js which scans the source code. All it needs to start its internal list of files that should be 100% typed. Eventually, all files should go into category a). The files in category b) are almost there. This is what needs to happen to get them there. 1) choose a file to make 100% typed 2) add the file to the list in webodf/tools/updateJS.js 3) run 'make manifest.json-target' or 'ninja manifest.json-target' to update the build files. 4) run 'make typecheck-target' or 'ninja typecheck-target' and fix all issues that come up (repeat until they are all fixed) 5) run 'make' or 'ninja' to check that the entire build is fine 6) push your work and submit a pull request. We have probably passed the 50% mark already so we will get there before the end of the year for sure. Cheers, Jos
participants (1)
-
Jos van den Oever