Linting your ColdFusion code

Earlier this week I discovered a new project on GitHub, CFLint. For my readers who may not be aware, linters are tools that inspect your code for bugs, best practices, and other issues. Numerous different types of linters exist, but as far as I know this is the first one for ColdFusion. It is still a bit rough (in my tests it would routinely have parsing issues on some of my files) but it is a good start and I think it could be a great tool for ColdFusion developers.

You can test this yourself on the project’s releases page. They included scripts for both OS X and Windows. The core code is Java based if you want to peak under the hood. Like most linters, you can also disable rules you don’t agree with. As I said, it isn’t perfect, but I’d strongly urge folks to check it out and – even better – help improve it.

Want to test it out with ColdFusion Builder? I worked on an extension for it last night. You can right-click on a project, folder, or file and scan it using CFLint. As an example:

You can click on each line item to open the file right to the line reported by CFLint. Currently the biggest issue is that it doesn’t provide feedback while it is working. If you test it on a large project, keep that in mind. You can download my extension here:

  • aaorn

    does it lint cfscript code?

    • http://www.raymondcamdencom/ Raymond Camden

      I honestly don’t remember. I’d check with the project owner.

  • orcpac7

    Thanks Ray, I discovered your blog entry after getting CFLint going… Saw it in a Sublime blog somewhere, never got it running there, but went ahead and tooled up to install it as a stand-alone and VERY happy, though it has a way to go.
    Just as an aside, I’ve been using Chris Weller’s “CodeChecker” for some time, a linter written in ColdFusion and extensible as well, but nowhere near as fast as CFLint.

    • http://www.raymondcamdencom/ Raymond Camden

      I have to admit I had forgotten about this. :)

  • Leslie Sherman

    Hi, I noted that the cflint extention for CFBuilder works for CF 10. Does it also work for CF 11? We are migrating from CF 9 to CF 11 and want to do some testing of how much code may be affected by the removed tags and tag parameters. A lint checker seemed like a nice way to do this.

    • http://www.raymondcamdencom/ Raymond Camden

      I’d ask the project owner. I haven’t used this since the blog post as I don’t do much CF work anymore.