Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotation-based configuration #707

Open
chandler3224 opened this issue Jun 10, 2021 · 6 comments
Open

Annotation-based configuration #707

chandler3224 opened this issue Jun 10, 2021 · 6 comments

Comments

@chandler3224
Copy link

The option to use comments to ignore lines/specific rules doesn't seem to be working when running from the command line.
I'm running against the following code:

<cfcomponent displayname="test" output="false" hint="test">

	<cffunction name="init" access="public" output="false" returntype="test">
        <cfscript>
		var testa = ''; //cflint ignore:line
		return this;
	</cfscript>
    </cffunction>
    
</cfcomponent>

testa is never ignored. I have tried multiple variations.

Environment

Version: 1.5.0 (also tested 1.4.1)
Windows 10

java -version
java version "1.8.0_291"
Java(TM) SE Runtime Environment (build 1.8.0_291-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.291-b10, mixed mode)
@begin-again
Copy link

Since you are within a tag context, try the tag-style comment <!--- --->

@chandler3224
Copy link
Author

chandler3224 commented Jun 10, 2021

Ah yes, wasn't the best example. However I used this and still the same

<cfcomponent displayname="test" output="false" hint="test">

    <cffunction name="init" access="public" output="false" returntype="test">
        <cfset var testA = '' /> <!--- @CFLintIgnore line --->
        <cfreturn />
    </cffunction>
    
</cfcomponent>

Used combinations of @CFLintIgnore and just cflint. Thanks for the quick reply though.

@begin-again
Copy link

I write mostly in CFScript and have found that the annotations do not work at all and the rules themselves have a lot of false positives.

/*
    @CFLintIgnore MISSING_SEMI,AVOID_USING_CREATEOBJECT,UNUSED_LOCAL_VARIABLE
*/

@chandler3224
Copy link
Author

Yeah, it seems the same with me. The tag comment only works for the whole file as long as it's before a component/function, doesn't support individual lines.

The cfscript comments support seems like it supports some annotations and not others. For example with this mixed snippet:

Works

<cfcomponent displayname="test" output="false" hint="test">
	<cffunction name="init" access="public" output="false" returntype="test">
        <cfscript>
            testB = ''; // cflint ignore:line
        </cfscript>
        <cfreturn />
    </cffunction>
</cfcomponent>

Doesn't work

<cfcomponent displayname="test" output="false" hint="test">
	<cffunction name="init" access="public" output="false" returntype="test">
        <cfscript>
            var testB = ''; // cflint ignore:line
        </cfscript>
        <cfreturn />
    </cffunction>
</cfcomponent>

Note the addition of the var.
Strange one.

@nukleos
Copy link

nukleos commented Jul 14, 2021

I can confirm that (tag-based) annotations have to be the first thing to put in a file, before <cfcomponent ...>, for them to work on the whole file.

@gpickin
Copy link

gpickin commented Sep 28, 2021

Ok, I'm not crazy, I can't get the annotations to work for me,
I tried all the variations... doesn't seem to work.
I'm in all script, in queryExecute, I tried almost every syntax, and nothing.
I'm running with the commandbox cflint command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants