Open elpete opened 4 years ago
This sounds like a nice idea. I am currently concerned about performance. The way the globber lib currently works (I think) is that, if your glob includes **
in it, it has to list every single file in the base directory in order to test it against the glob. So for instance if I did:
cfformat run ./
Under the hood, that path is treated as ./**.cfc
, and globber will list every single file in the directory, and all sub directories, to test if it is a component, and then test it against the exclude patterns provided. So if your directory has a node_modules
sub directory (for instance) you will get terrible performance out of the glob even if you specify node_modules
in an exclude pattern, since all files will be listed before being excluded from the result.
I think it would be nice if the globber modules could be smarter about using directoryList
with recurse
, but I am not sure how much work that would be.
I am currently creating scripts that specify all the globs I want to format in my
box.json
package scripts. This can get rather long and repetitive....It could be a nice feature to check for some kind of ignore file so I could add files that should never get formatted. I assume this would follow the
.gitignore
syntax. (I believe CommandBox has some built in functions to help with this.) The command could look for a.cfformatignore
file by default while allowing an alternate file name to be passed in. Additionally, perhaps a global.cfformatignore
could be specified as a module setting. Then I won't ever accidently format all of ColdBox again. :sweat_smile: