https://kotlinlang.org logo
#detekt
Title
# detekt
s

Sebastian Schuberth

01/05/2021, 1:52 PM
Is there an easy way to get the relative path to a file WRT the Gradle root project in a `Rule`'s
visitPackageDirective
function?
I'm current using
directive.containingKtFile.name
which return the absolute path. Does a detekt rule even know about the Gradle project structure?
b

Brais Gabin

01/05/2021, 10:22 PM
It does not. But right now there's a PR that implements exactly that: https://github.com/detekt/detekt/pull/3319 the initial idea was for reporting proposes but you could use it.
c

chao

01/05/2021, 10:31 PM
Hopefully it will arrive soon.
s

Sebastian Schuberth

01/06/2021, 7:55 AM
Thanks for pointing out that PR to me, I'll continue commenting over there!
❤️ 1
5 Views