Dynamically Testing with IOC + CFLint

Hi All,
I am hoping someone has already done this but I can not seem to find any examples of using CFLint in BBD tests. in my unit test , I want to test ALL cfc files in a specific directory before releasing my code to production.

I have inherited a project with years of very old code, and I want to validate the code before releasing it. The new project is moving the old code to fw/1, but we need to make sure the files are up to date, and not failing basic CFLint rules.

Here is my over all idea:

  1. in my /tests/application.cfc load up CFLint and IOC (fw/1 IOC)
  2. when the application starts, ill load all the beans from IOC and call the CFLint.scan() method on the path to the cfc. I have this built but its not actually producing a result for known files that are failing CFLinting within VSCode.
  3. My main test will produce the results as a test runner

If there is an easier way, I would love to hear it, the idea is to not have to write a test for every cfc file, but to dynamically do this.

thanks in advance.

Tim

box install commandbox-cfformat
box cfformat check /path/to/beans

If you add a .cfformat.json to your repo you can have granular control of how you format, like so.

Hi,
Thank you for the response, so this will run CFLint on a folder?

This is a different module from CFLint, but I find it easier to work with and more powerful.

If you want to use CFLint, exactly, here is the CommandBox module for that. You can install it in CI and run the commands in the docs: FORGEBOX: commandbox-cflint