Skip to content

ParenPad: deep scan picks up excess tokens not set in config #4175

@rnveach

Description

@rnveach

Identified in #4109 (comment) ,

ParenPad is doing a deep scan for tokens to check at

private void processExpression(DetailAST ast) {
if (ast.branchContains(TokenTypes.LPAREN)) {
DetailAST childAst = ast.getFirstChild();
while (childAst != null) {
if (childAst.getType() == TokenTypes.LPAREN) {
processLeft(childAst);
processExpression(childAst);
}
else if (childAst.getType() == TokenTypes.RPAREN && !isInTypecast(childAst)) {
processRight(childAst);
}
else if (!isAcceptableToken(childAst)) {
//Traverse all subtree tokens which will never be configured
//to be launched in visitToken()
processExpression(childAst);
}
childAst = childAst.getNextSibling();
}
}
}
.
This caused tokens that were specifically not set in the configuration to be picked up for violations as seen in Issue #3048.
It is weird to validate tokens outside of check's configuration and users won't be expecting this. It even caused no differences to appear in regression reports for default module even when new token was added to the check. We only saw differences when running on very limited/specific tokens.

We need to remove this deep scan from the check.
We then need to identify if there are any differences in the regression report. If there are any differences, those areas have to be identified and added as new tokens to the check.
When all this is done, we expect no differences for default module in regression on final implementation. Differences on specific tokens is ok.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions