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

False positive on package name check #276

Closed
Tapchicoma opened this issue Sep 3, 2018 · 3 comments
Closed

False positive on package name check #276

Tapchicoma opened this issue Sep 3, 2018 · 3 comments

Comments

@Tapchicoma
Copy link
Collaborator

I have a test module that contains two files.

Ktlint (0.27.0) produces following error for both files:
Package directive doesn't match file location (cannot be auto-corrected) (package-name)

while this files has valid package and AS doesn't suggest me to correct it:

package com.freeletics.core.tracking.test

Here is a log from ktlint check:

[DEBUG] Discovered ruleset "standard"
[DEBUG] Discovered reporter "plain"
[DEBUG] Discovered reporter "json"
[DEBUG] Discovered reporter "checkstyle"
[DEBUG] Initializing "plain" reporter with {verbose=true, color=false}
[DEBUG] Initializing "checkstyle" reporter with {verbose=true, color=false}, output=/work/freeletics-android/test/tracking/build/reports/ktlint/ktlint-debug.xml
[DEBUG] Checking /work/freeletics-android/test/tracking/src/main/java/com.freeletics.core.tracking.test/TestTracker.kt
[DEBUG] Checking /work/freeletics-android/test/tracking/src/main/java/com.freeletics.core.tracking.test/TestTrackerAssertions.kt
[DEBUG] Discovered .editorconfig (/work/freeletics-android) {insert_final_newline=true, max_line_length=120}
/work/freeletics-android/test/tracking/src/main/java/com.freeletics.core.tracking.test/TestTracker.kt:1:1: Package directive doesn't match file location (cannot be auto-corrected) (package-name)
/work/freeletics-android/test/tracking/src/main/java/com.freeletics.core.tracking.test/TestTrackerAssertions.kt:1:1: Package directive doesn't match file location (cannot be auto-corrected) (package-name)
"checkstyle" report written to /work/freeletics-android/test/tracking/build/reports/ktlint/ktlint-debug.xml
[DEBUG] 728ms / 2 file(s) / 2 error(s)
@shyiko shyiko closed this as completed in ce91803 Sep 5, 2018
@shyiko
Copy link
Collaborator

shyiko commented Sep 5, 2018

Fixed in 0.28.0.

@Tapchicoma
Copy link
Collaborator Author

Damn, missed that package directory is with dots. Anyway thank you for fix!

@BulatMukhutdinov
Copy link

I am using 0.28.0 but still get this error. I have shred dir for tests called testShared and one class inside this dir.
Error is
/Users/bulat_mukhutdinov/StudioProjects/asia-chat/asiapay/src/testShared/MockData.kt:1:1: Package directive doesn't match file location (cannot be auto-corrected)

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

No branches or pull requests

3 participants