I'm using the VS Code editor. And I have installed CFLint on my editor. On Application.cfc I see 'Identifier this is global, referencing in a CFC or function should be avoided.cflint(GLOBAL_VAR)' message when I mouse over into this scope.
Please explain this little bit elaborate. Thanks in advance.
The
thisscope in ColdFusion is equivalent to Java'spublic <type> <variable>declaration, a.k.a. "public fields". You can read and write these variables from anywhere, which is usually a bad thing (violates OOP encapsulation, is not thread-safe etc.).This is also true for components (classes) in ColdFusion. However, the
Application.cfcis a special case where this linter warning doesn't make any sense since "Application" is a singleton handled by ColdFusion and you cannot encapsulate it's configuration fields that reside inthis.Conclusion: Ignore this message in
Application.cfcfor all built-in fields, but follow it in every other.cfcfile.(You might want to report this to the linter's maintainer.)