Skip to content
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

Warnings are not reported at the correct line number #139

Closed
davidgyavol opened this issue Jun 28, 2017 · 7 comments
Closed

Warnings are not reported at the correct line number #139

davidgyavol opened this issue Jun 28, 2017 · 7 comments
Assignees

Comments

@davidgyavol
Copy link

davidgyavol commented Jun 28, 2017

I'm using this version of detekt: "1.0.0.M12.1"
The number of warnings reported are correct but the sometimes the line number where the rule is broken is not accurate.

I created a new project with only the following class as example:
https://gist.github.com/davidgyavol/bcd9bfdec7eb2af06fadac7718bf8a25
MaxLineLength is set to 100.
The following lines should break the rule: 180,181 but after i run detektCheck I get the following warnings related to the MaxLineLength check:

	<error line="176" column="9" severity="warning" message="(MaxLineLength)" source="detekt.MaxLineLength" />
	<error line="180" column="55" severity="warning" message="(MaxLineLength)" source="detekt.MaxLineLength" />

This reproduces with other checks too (EmptyClassBlock should be at line 80)

<file name="com/example/gyavoldavid/myapplication/Main.kt">
	<error line="66" column="1" severity="info" message="(EmptyClassBlock)" source="detekt.EmptyClassBlock" />
	<error line="3" column="1" severity="warning" message="(WildcardImport)" source="detekt.WildcardImport" />
	<error line="176" column="9" severity="warning" message="(MaxLineLength)" source="detekt.MaxLineLength" />
	<error line="180" column="55" severity="warning" message="(MaxLineLength)" source="detekt.MaxLineLength" />
</file>
@davidgyavol davidgyavol changed the title Issue with MaxLineLength check Warnings are not reported at the correct line number Jun 28, 2017
@arturbosch
Copy link
Member

Need too check this out! Partly this issue is known to me as the kotlin compiler somethings gives we wrong numbers for some nodes and for one specific formatting rule even throws an exception (OutOfBound but file is 100% ok!) ...

@sschuberth
Copy link
Contributor

Is this still on track for being resolved for 1.0.0 final? I'm asking because I see the RCs flying by without any update on this issue.

@arturbosch
Copy link
Member

@jbaginski fixed this for MaxLineLength. It is on track. Had no other complainings about line and column mismatches but this is an important thing if we want to build other tools around detekt's reports.

@Mauin
Copy link
Collaborator

Mauin commented Dec 24, 2017

Are there more rules which can report their warnings on the wrong lines? If yes, let's list them here, if no, let's close this issue.

@arturbosch
Copy link
Member

Will look into it soon.

@arturbosch
Copy link
Member

Took a sample in detekt. Line numbers are correct. Columns are incorrect when using tabs (they are interpreted as one). Nothing we can do about it, so I'm closing this.

@arturbosch arturbosch removed this from the RC13 milestone Feb 17, 2019
@lock
Copy link

lock bot commented Jun 19, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants