Closed ecellini closed 4 years ago
Hey @ecellini - I don't think there's a commandbox-cflint
parameter to specify the config file.
I believe I ran into this myself a month ago. It seemed that CFLint ignored my .cflintrc
file entirely. As far as I can tell, commandbox-cflint
needs to load that .cflintrc
file when initializing CFLint - this is not something that's taken care of by CFLint, at least not when using the CFLint java API.
@jsteinshouer Looking at the CFLintApi class, you can pass in a configuration
object/class to CFLintAPI.scan()
. We should be able to use CFLint's ConfigFileLoader
class to load the .cflintrc
file from the current directory if it exists.
Perhaps changing https://github.com/jsteinshouer/commandbox-cflint/blob/master/commands/cflint.cfc#L286 to the following would do it?
if ( fileExists(".cflintrc") ) {
var configLoader = createObject( "java", "com.cflint.config.ConfigFileLoader", 'com.cflint.CFLint' ).init();
var configuration = configLoader.loadConfig( ".cflintrc" );
var api = createObject( "java", "com.cflint.api.CFLintAPI", 'com.cflint.CFLint' ).init( configuration );
} else {
var api = createObject( "java", "com.cflint.api.CFLintAPI", 'com.cflint.CFLint' ).init();
}
I'm sorry, this is not a commandbox-cflint issue at all - it's an issue upstream in CFLint. I even commented on it a month ago - see https://github.com/cflint/CFLint/issues/624
Thank you Michael!
Hello Jason, thank you for commandBox-CFlint!!
I have i little issue, I would like use some rules on cflint and i have file .cflintrc on project root (i use this on SublimeText+CFlint) but commandBox-CFlint don't use these file and check all rules.
There is a parameter to specify per path of .cflintrc?
I write this command:
cflint **.cfc
Thank you