关于Javascript静态分析工具的问题,如Google Closure、JSHint、JSLint
Question on Javascript static analysis tool like Google Closure , JSHint , JSLint
像Google Closure、JSHint、JSLint这样的Javascript静态分析工具能做到以下几点吗:
- 他们能识别源代码中未使用的Javascript文件和函数吗
- 他们能识别源代码中重复的Javascript文件和函数吗
这些静态分析工具没有文件的概念,只有代码的文本表示。因此,它们不会识别未使用或重复的文件。他们必须了解如何部署文件才能做到这一点。
它们不会识别未使用的功能。
它们确实识别了同一文件中的重复函数。至少在大多数情况下:
function a() {}
/* ... */
function a() {}
会给你a is already defined
。但是:
var a;
a = function () {};
/* ... */
a = function () {};
是完全合法的,不会给你带来错误。
如果你想在所有文件中找到重复的函数,你可以在linting之前简单地将它们连接在一起。
我们的CloneDR静态分析工具将为包括JavaScript在内的许多语言找到任意代码片段的精确且近乎重复的副本。它将在文件内部和文件之间执行此操作。(CloneDR未检测到未使用的代码。)
相关文章:
- Google Closure Advanced |无法识别对象属性|动态属性
- 如何在高级编译模式下使用 Google Closure 编译器编译 jQuery UI 小部件
- RegExp的Google Closure编译器警告
- Google Closure编译器为命名空间创建了不完整的别名
- @private注释在 Google Closure JavaScript 代码中实际上做了什么
- Google Closure Linter 在 Sublime Text 2 for Windows 中不起作用
- 如何使用 Google Closure API 移除调试代码
- Google Chrome Heap Snapshots (closure), (array), (system), (
- Google Closure Compiler Service 提供无效代码
- 使用 Google Closure Builder 时,我可以使用现有的 deps.js 文件而不是跟踪路径
- AngularJS Google Closure Compiler with Google API
- Commenting JavaScript for Google Closure Compiler for Single
- AngularJS无法使用Google Closure App+Ant编译
- 使用Google Closure从LabelInput访问数据
- 在应用程序代码上运行Google Closure编译器后,更新AngularJS模板HTML
- 来自Google Closure编译文件的TypeError
- 使用plain .js文件(Google Closure'd)在ClojureScript中使用lein-clj
- Google Closure支持手风琴吗?
- Jquery vs Google Closure va GWT Pros &大型web应用程序开发的缺点
- js-doc / google-closure-compiler 如何记录传递的枚举对象本身