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

inline ignore ARG_TYPE_MISSING -- support inline ignores at the statement level. #497

Closed
SteveLeve opened this issue Dec 20, 2017 · 2 comments
Assignees
Milestone

Comments

@SteveLeve
Copy link

First off, I want to thank everyone for all the hard work and I'm excited to be getting started with this, hopefully I'll be able to make some contributions to the project in the future.

I originally posted this at cfml.slack.com in the cflint channel, but haven't received a response and I'm not sure where else to ask, so, I'm bringing this over here. Original message follows.


I have a question regarding inline ignore.
This appears to be the correct syntax, yes?

public struct function validate( argA, argB, argC ) { //cflint ignore:ARG_TYPE_MISSING
    // validation logic
    return {};
}

in general I want this rule applied but want to provide inline exceptions where necessary

also Multiline ignore annotation
https://github.com/cflint/CFLint/blob/2fa060b7ec8a6df1a521bc1fd408cf72ffdf202f/src/test/resources/com/cflint/tests/Ignores/ignoreCFMLAny2.cfc

I tried this, but it didn't seem to work either;

/*
  @CFLintIgnore ARG_TYPE_MISSING
*/
public struct function validate( argA, argB, argC ) {
// validation logic
return {};
}

I do not see test coverage in the source specifically for this syntax ( I do see a test for missing_var for comparison );
https://github.com/cflint/CFLint/search?utf8=%E2%9C%93&q=MISSING_VAR&type=
https://github.com/cflint/CFLint/search?utf8=%E2%9C%93&q=ARG_TYPE_MISSING&type=

can anyone confirm this or educate me on what I'm missing? (edited)

I've tested this in isolation running from the command prompt using versions 1.2.0 and 1.2.2
I've tested in VS Code & Sublime Text 3 as well with the same results

I attached my latest Test.cfc and result
CfLint.zip

@ryaneberly
Copy link
Contributor

There is a bug in pre-1.3.0 for inline ignores in mixed cftag and cfscript source code.

The following does work for me:

component {

    /*
    	@CFLintIgnore ARG_TYPE_MISSING,ARG_DEFAULT_MISSING
    */
    public struct function validate( foo ) { 
        // validation logic

        if( isNull( arguments.foo ) ) {
            arguments.foo = '';
        }

        return {
            'foo' : arguments.foo,
        };
    }

}

ryaneberly added a commit that referenced this issue Dec 21, 2017
  implemented inline ignores for cfscript structures
@ryaneberly
Copy link
Contributor

@SteveLeve , There are two kinds of code structures in CFLint. expressions and statements, the inline ignores were working for messages that flag at the expression level, but not at the statement level. This is fixed in dev and will work better in v 1.3.0.

Thanks for taking the time to accurately report the issue you were having.

@ryaneberly ryaneberly self-assigned this Dec 21, 2017
@ryaneberly ryaneberly added this to the 1.3.0 milestone Dec 21, 2017
@ryaneberly ryaneberly changed the title inline ignore ARG_TYPE_MISSING inline ignore ARG_TYPE_MISSING -- support inline ignores at the statement level. Dec 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants