Twitter: raymondcamden


Address: Lafayette, LA, USA

Linting your ColdFusion code

07-31-2014 2,777 views ColdFusion 14 Comments

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: https://github.com/cfjedimaster/CFLint-Extension.

14 Comments

  • Donnie #
    Commented on 07-31-2014 at 10:33 AM
    Will the CFLint project work with Sublime Text 2?
  • Donnie #
    Commented on 07-31-2014 at 10:34 AM
    Ignore please. Reposting to subscribe.
  • Commented on 07-31-2014 at 10:35 AM
    Check out the CFLint project - they link to a Sublime version.
  • Ryan Eberly #
    Commented on 07-31-2014 at 9:07 PM
    Good article, Ray. We'll have to see what we can do about a progress bar.
  • Dan Kraus #
    Commented on 07-31-2014 at 11:59 PM
    Donnie, I happened to be looking at this today. Seems
    Iike Sublime support is only available with SublimeLinter3 which is a Sublime 3 package.

    I had thrown it at a smaller application. I got a lot of warnings back that had no description. Need to take a closer look but this is a great start and better than nothing at all. It's like varscoper taken to the next level.
  • Donnie #
    Commented on 08-01-2014 at 11:33 AM
    @Dan @Raymond Thanks. I've seen the Sublime 3 package, but 3 is still in beta. Is anyone using version 3 yet?
  • Dan Kraus #
    Commented on 08-01-2014 at 11:43 AM
    @Donnie I'm not. I don't think there's been an update to ST3 beta in close to a year. I think the maintainer dropped off.

    I was going to give ST3 beta a shot really for purpose of integrating directly in with CFLint but the prospect of retooling all my configurations, packages, and everything else seemed a bit daunting. Also, some people on my team noted some issues with our project in ST3. I could see in the console it trying to constant read a non-open file that is particularly lengthy. ST2 has issues opening up. I think it screws with the formatter. But again, only when you actively try to open it. ST3 had things in the console log if it trying to constantly read it. Probably some sort of caching feature or something...
  • Dave Jones #
    Commented on 08-05-2014 at 10:48 AM
    Great extension, thanks Ray! When I first tried running this, I was getting an error in CF Builder: CFLint: Error occurred while parsing response from handler "/handlers/runlint.cfm". I discovered (through one of your previous blog posts) that this was because I had CF debugging enabled on the server I was running the extension against. I disabled debugging and the extension works great!

    Hope this comment helps anyone else who might run across this issue.
  • Commented on 08-05-2014 at 10:50 AM
    Oops, I'll add code to disable debugging in the extension, that way you can leave it on.
  • Commented on 08-05-2014 at 10:52 AM
    The code has been updated.
  • Derek #
    Commented on 08-07-2014 at 2:49 PM
    I am trying this out, but it's not working correctly. I see a window pop up for a brief second after i call it, but that's it. No new tab shows up like in your image.
  • Commented on 08-07-2014 at 2:50 PM
    In CF Builder, ensure you have callbacks enabled and are using the full or trial edition of CFB, not express.
  • Derek #
    Commented on 08-07-2014 at 2:56 PM
    It is enabled, and it is the trial of CFB3
  • Commented on 08-07-2014 at 3:08 PM
    Best I can suggest is to check your CF logs. Extensions are just CFML and log the same.

Post Reply

Please refrain from posting large blocks of code as a comment. Use Pastebin or Gists instead. Text wrapped in asterisks (*) will be bold and text wrapped in underscores (_) will be italicized.

Leave this field empty