Varscoper 用于基于 CFScript 的组件

发布于 2024-12-08 06:18:06 字数 250 浏览 0 评论 0原文

众所周知,对于任何重要的项目来说,对 ColdFusion 代码进行 varScoping 是绝对必须的。

CF9 为 CFScript 带来了许多增强功能,例如能够在脚本中编写整个 CFC,包括组件、函数和属性标签。

但是 varScoper 无法与 cfScript 定义的函数/组件一起使用。它只是不尝试检查脚本中声明的函数。

问题是,每个人都使用什么来对基于 cfScript 的 CFC 进行变量作用域?

戴夫

As we all know, varScoping your ColdFusion code is an absolute must for any non-trivial project.

CF9 brings many enhancements to CFScript, such as being able to write entire CFC's in script, including component, function and property tags.

However varScoper won't work with cfScript defined functions/components. It just doesn't attempt to check functions declared in script.

The question is, what is everyone using for varscoping their cfScript based CFC's?

dave

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抚笙 2024-12-15 06:18:06

VarScope 采用 Apache 许可证,因此是“开源”的。您可以随时与负责它的人联系,看看他是否对第三方更新感兴趣,也许您可​​以自己进行更改?它肯定会为您赢得社区布朗尼积分!

我知道,这并不是一个完全令人满意的答案。

回答您的实际问题:在 CF 完全覆盖我们在 CFC 中使用(或可能想要使用)的功能之前,我们不会实现任何仅脚本 CFC。对于基于标签的代码,我们只使用严格的编码标准,并在提交任何内容发布之前进行代码同行评审。我们偶尔会运行 varscoper,但它在发现问题方面不如两双眼睛那样好:varscoper 似乎确实会出现很多误报。

另一个考虑因素是,如果您有 100% 的单元测试覆盖率(是的,我知道:谁有?),那么在运行测试后检查 CFC 变量范围内的内容将显示变量范围内的任何泄漏。

VarScope is under an Apache licence, so is "open source". You could always touch base with the bloke in charge of it and see if he'd be interested in third-party updates to it, and perhaps you could make the changes yourself? It would certainly earn you community brownie points!

Not an entirely satisafactory answer, I know.

To answer your actual question: until CF has full CFScript coverage for the functionality we use (or are likely to want to use) in CFCs we won't implement any script-only CFCs. And for our tag-based ones we just use a tight coding standard and have code peer review before committing anything for release. Occasionally we run varscoper, but it does a less good job of finding problems than two sets of eyes do: varscoper does seem to come up with a lot of false positives.

Another consideration is that if you have 100% unit test coverage (yes, I know: who does?) then checking what's in the variables scope of a CFC after you've run your tests will show up any leaks into the variables scope.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文