-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Issue #11166: remove getFileContents from EmptyLineSeparator #14819
Conversation
dealing with comment tokens in the AST was weird to me. why it is under modifiers of the next subtree. is there a reason to build AST like this? int x;
// m
public int m() {
return 0;
}
@romani @nrmancuso @rnveach |
private DetailAST findFirstCommentToken(DetailAST ast) { | ||
final DetailAST modifersAst = ast.findFirstToken(TokenTypes.MODIFIERS); | ||
final DetailAST commentAst; | ||
|
||
if (modifersAst != null) { | ||
commentAst = modifersAst.getFirstChild(); | ||
} | ||
else { | ||
commentAst = ast.getFirstChild(); | ||
} | ||
return commentAst; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will work more on this method. I believe that there are more cases that need to be handled to get the first comment token
Github, generate report |
@nrmancuso ping |
Yeah, comment placement in the AST is super weird, and has been for a long time. We have at least one issue on this. I can’t really imagine this check working well without getting file contents honestly. IMO, this check should continue to use getFileContents |
Yes, I tried a few times to continue this PR but things always get very messy and error-prone. I couldn't reach a good design. we should consider refactoring comments AST first before migrating this check to AST-based logic
same and just wanted to know your opinion before taking a decision on this, should I close it or add blocked due to (#6233) or abandoned label |
I am. |
We will not be able to complete this issue before GSOC. @mahfouz72 let's close this for now, and come back after summer. All your work will be saved via the link in the issue, and you can keep this branch in your fork to pick up later. |
Issue #11166 :
refactor EmptyLineSeparatorCheck to use AST-based logic not
getFileContents()
Diff Regression config: https://gist.githubusercontent.com/mahfouz72/afd57aa6e51ca161b7927acd959e5211/raw/9384f843297bb2e10c074bcb33ddc46902d6bd52/check.xml
WIP. just wants to get an initial review from CIs and maintainers