1

I've seen multiple cases in which my lazy coworkers copy paste a file without changing the package.

Kotlin is cool about it, and the only one issuing a warning is the IDE.

Is there a way so that the compiler fails on THAT warning? or maybe... via ktlint?

caeus
  • 3,084
  • 1
  • 22
  • 36
  • I don't know the answer, but it may be difficult to get a tool that gets this right, because it is a recommended convention to optionally omit a common path, for example package `com.company.product.foo.bar.baz` may live in `src/main/kotlin/foo/bar/baz` if all package names start with the prefix `com.company.product`. So a tool that checks if a file is in the correct directory would have to know what the common package prefix is - and that's something that's not easy to determine programmatically. – k314159 Aug 15 '23 at 16:11

0 Answers0