Comments (8)
#14780 isn't truly about tabs, so I don't see how we are calculating tabs incorrectly
@rnveach , yep sorry, my bad.
The snapshots were hard to read and I misread '8' as '0', hence got bit confused :)
from checkstyle.
letβs reproduce it with an existing check
In addition, see https://checkstyle.org/report_issue.html#How_to_report_a_bug.3F .
Please do not post with pictures, it makes it hard to read and copy for reproduce testing.
from checkstyle.
When a case is provided, it will have to be examined if this issue is related to #14780 as both are javadocs.
from checkstyle.
When a case is provided, it will have to be examined if this issue is related to #14780 as both are javadocs.
@rnveach , your reference is accurate.
This issue reported here is an after effect of what we found of column number mismatch at #14780
It is getting reflected probably as we log violations by AST parsing. It makes me wonder where else we have been missing π
from checkstyle.
If this is a duplicate of #14780 then we need to close this issue.
I can't argue against closing as too few details are given in this issue. #14780 isn't truly about tabs, so I don't see how we are calculating tabs incorrectly. All our AbstractCheck
log methods use tab conversion code so you could show a case with nearly all our checks if one existed.
If the method is expecting 1-base and we are giving it 0-base then that is the issue and that is how it connects. However, looking at that method's code it does appear to be 0-based as well. So I am not seeing the connection yet.
from checkstyle.
This may be the issue, which is unrelated to #14780 .
Shouldn't this be len += tabWidth
? I am not understanding where this division is coming from.
It looks like it is saying tabs go up to a certain position and then stop. Meaning 2 spaces plus a tab stop at the same position as a tab alone. That does make sense as I have seen some tools do this.
Javadoc:
Each tab is counted as the number of characters is takes to jump to the next tab stop.
@Zopsss Please try to create a case.
from checkstyle.
Hey @rnveach Thanks for reviewing the issue. I have fixed the failing test case mentioned in this issue. I'll explain in detail why I opened this issue and what problem I was facing. I'll reply to your questions soon as it is already mid night here. Thanks again for showing your interest in this issue.
from checkstyle.
I have updated the issue description explaining the problem I was facing in a more precise way
I was passing the column number of leading asterisk with expanded tabs to the log() method. The log()
method internally calls lengthExpandedTabs() which calculates the column number at a specific position of the provided string by expanding the tabs.
So I was already passing the asterisk's column number with the expanded tabs to the log()
method as mentioned here:
log() method is receiving the asterisk's current column number
Here by current column number
I meant the column number of the leading asterisk with expanded tabs.
At that time I wasn't sure what is the use of the lengthExpandedTabs()
because I didn't knew the term expanding tabs
in string. The log()
was receiving the column number of the leading asterisk after expanding the tabs, this column number was being passed to the lengthExpandedTabs()
, so it was receiving the wrong column number because I was passing the column number with tabs already expanded while the lengthExpandedTabs()
method expects to receive the original column number ( without expanded tabs ), that's why it was calculating the column number incorrectly.
So to fix this, I modified the Check implementation to pass the column number of the leading asterisk without tabs expanded to the log()
method. Now that the log()
method is receiving the column number without tabs expanded, it gets passed to the lengthExpandedTabs()
method and it calculates the column number by expanding tabs and everything works fine.
The lengthExpandedTabs()
method is working fine, I was just passing the wrong column number to it that's why it was calculating the incorrect column number. All the problems I was facing has been resolved, I will close this issue now. And sorry for the delay I was busy with college stuff so it took a little longer to reply.
from checkstyle.
Related Issues (20)
- How to exclude java-Files that contain @Generated-Annotation? HOT 4
- Improve documentation - how to add usage of `var` to check `IllegalType`? HOT 6
- Column number in `DetailNode` should start with 1 HOT 16
- LITERAL_DEFAULT token support in RightCurlyCheck
- False Negative of ClassFanOutCheck with "new" Keyword HOT 6
- MagicNumberCheck NPE when ignoring field declarations HOT 11
- Parse exception for RAW string template (Java 21+) HOT 3
- IllegalType Not Working For Annotation Using FQN HOT 3
- Remove Support for String Template Syntax
- Re-enable and Monitor `YAMLSchemaValidation` inspection HOT 6
- Resolve `TailRecursion` inspection violations by replacing tail recursive calls HOT 4
- WhitespaceAround reports a violation when switch expression is passed as a method argument HOT 2
- Parameter name should be provided after @param tag HOT 1
- Please REMOVE most badges from the README HOT 5
- Please, add a small section to the README on how to install and use this tool HOT 5
- Test to ensure website checks/filters are in alphabetical order
- Fix performance test HOT 3
- build failure due to maven.plugin.json HOT 2
- Github generate site fails to generate links with anchors.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from checkstyle.