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

NPathComplexityCheck: set of tokens should not be customizable by user #3797

Closed
romani opened this Issue Feb 4, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@romani
Member

romani commented Feb 4, 2017

This check can not work with reliably if user can change set of TokenTypes, if user miss QUESTION in config, algorithm will work incorrectly. So user should now have ability to change this.

Current code is:

     public int[] getRequiredTokens() {
         return new int[] {
             TokenTypes.CTOR_DEF,
             TokenTypes.METHOD_DEF,
             TokenTypes.INSTANCE_INIT,
             TokenTypes.STATIC_INIT,
         };
     }

Looks like the intend was to let user control on what blocks of code to run Check: on methods, on ctors, on static initializations, or instance init. But in this case all other tokens should be hardcoded in Check and Check need to walk on them itself.

We should not continue that intend (code is not doing this even now) and user should not have ability to control tokens set, so all methods should call getAcceptableTokens.

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Feb 9, 2017

Member

fix is merged

Member

romani commented Feb 9, 2017

fix is merged

@romani romani closed this Feb 9, 2017

bamapookie added a commit to bamapookie/checkstyle that referenced this issue Feb 10, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment