Issue #18614: Fix tab-based indentation validation in getIndentImpl#19062
Issue #18614: Fix tab-based indentation validation in getIndentImpl#19062MiniPiku wants to merge 1 commit into
Conversation
1a7f507 to
0a54ab9
Compare
romani
left a comment
There was a problem hiding this comment.
we need tests extension to prove that it fixing issue
|
Thank you for the feedback. The required test extension is currently blocked by issue #19063, which is directly related to this problem. At the moment, adding new regression inputs causes Because of this coupling, we cannot properly add or validate the necessary tests until #19063 is resolved. Could you please review #19063 first? Once that issue is addressed, I will immediately proceed with adding the test extensions to fully cover this case. Let me know if you would prefer a different approach. |
|
There must be test method with Input that is copy from issue description. |
Before adding tests we need to resolve #19063 or else the tabs has to be resolved to 4/8 spaces and it defeats the whole purpose of the test. |
0a54ab9 to
7f50337
Compare
|
Hi @romani, |
|
Github, generate report for Indentation/all-examples-in-one |
7f50337 to
655c804
Compare
|
Report generation failed. Please check the logs for more details. |
|
@romani is this good to merge or any changes are required? |
|
Github, generate report for Indentation/Example1 |
|
We need report to see diff on big scale of projects |
|
Please review diff report |
0d6a04b to
c38a88f
Compare
|
Github, generate report for Indentation/Example1 |
|
Why I don't see exclude of file with tab, tab is forbidden, so there should be suppression of checkstyle violation. Do you know why ? |
Tabs are not suppressed here because IndentationCheck supports tabs via the The rule that forbids tabs is With this fix, these files are now handled correctly instead of being skipped due to the mismatch between raw and visual column calculations. Please let me know if suppression is expected for these configs. |
c38a88f to
acb0a12
Compare
|
Github, generate report for Indentation/Example1 |
|
Failed to download or process the specified configuration(s).
|
|
Github, generate report for Indentation/Example1 |
Description
Fixes #18614 - incorrect indentation validation for tab-indented files in
IndentationCheck.getIndentImpl()Root Cause:
The previous implementation compared:
getLineStart(mainAst)→ visual column (tab-expanded)mainAst.getColumnNo()→ raw character column (tab counts as 1)For tab-indented files, these values never matched, causing the branch responsible for computing expected indentation to become unreachable. As a result, incorrect indentation for the
newkeyword inside atryblock was not reported (false negative).Fix:
Replaced the inconsistent visual vs raw column comparison with
isOnStartOfLine(mainAst), which uses consistent visual column logic and properly handles tab expansion.This ensures:
Correct tab-indented code is validated properly
Incorrect tab indentation now reports violations
Space-indented behavior remains unchanged