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

KtLint formatting checks do not include full path in report #3063

Closed
damianw opened this issue Sep 9, 2020 · 2 comments · Fixed by #3097
Closed

KtLint formatting checks do not include full path in report #3063

damianw opened this issue Sep 9, 2020 · 2 comments · Fixed by #3097

Comments

@damianw
Copy link
Contributor

damianw commented Sep 9, 2020

As of 1.12.0, the formatting checks which wrap KtLint do not include the full path of the file in the reports.

Context

In order to be able to process results from Detekt reports, the full path of each file is needed to unambiguously identify the originating file.

Expected Behavior

With this example configuration (containing one of each a Detekt check and a KtLint check for demonstration purposes):

formatting:
  active: true
  NoUnusedImports:
    active: true
    autoCorrect: true
style:
  active: true
  UnusedImports:
    active: true

An unused import in a sample project outputs the following Checkstyle report when ran with Detekt 1.11.0 and earlier:

<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">
<file name="/Users/damian/Development/sample/app/src/main/java/com/example/sample/MainActivity.kt">
	<error line="10" column="1" severity="warning" message="Unused import" source="detekt.NoUnusedImports" />
	<error line="10" column="1" severity="warning" message="The import &apos;android.content.Context&apos; is unused." source="detekt.UnusedImports" />
</file>
</checkstyle>

The full path is recorded for both checks.

Observed Behavior

As of Detekt 1.12.0, the following Checkstyle report is generated:

<?xml version="1.0" encoding="utf-8"?>
<checkstyle version="4.3">
<file name="MainActivity.kt">
	<error line="10" column="1" severity="warning" message="Unused import" source="detekt.NoUnusedImports" />
</file>
<file name="/Users/damian/Development/sample/app/src/main/java/com/example/sample/MainActivity.kt">
	<error line="10" column="1" severity="warning" message="The import &apos;android.content.Context&apos; is unused." source="detekt.UnusedImports" />
</file>
</checkstyle>

The full path for the detekt.NoUnusedImports check is not reported - the file is only identified as MainActivity.kt. The path for detekt.UnusedImports is included as expected.

Your Environment

  • Version of Detekt used: 1.12.0 (I intended to also check 1.13.0 but it seems that this one has not been published yet)
@schalkms
Copy link
Member

Thanks for reporting this.
Is this expected @arturbosch with the following change 19ed18e ?

@jszmltr
Copy link

jszmltr commented Sep 21, 2020

Can confirm this is happening to me too.
Considering all other checks have correct path (only the formatting ones are broken), I don't think it is a expected behaviour.

1.13.0 seems to be having the same issue 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants