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

brent

06/25/2021, 1:34 PM
Any examples of using CLI version of detekt on an Android project with type resolution enabled? I'm able to run without type resolution but once I add the
--classpath
param to enable type resolution my execution time goes from a few minutes to ∞ and eventually an OOM crash.
g

gammax

06/25/2021, 2:01 PM
I’m not aware of sample projects. Generally on Android you would use the Gradle plugin. Is there a reason why you can’t use it?
b

brent

06/25/2021, 2:07 PM
We're currently using the gradle plugin. Trying the CLI version is a bit of an experiment.
g

gammax

06/25/2021, 3:22 PM
Are
detektMain
and other type-resolution enabled tasks running fine on your codebase?
b

brent

06/25/2021, 4:23 PM
Yes.
Tasks with
@RequiresTypeResolution
are being report correctly (and added to baseline correctly) with our current gradle setup. Just can't figure out or find an example of a CLI execution that uses the
--classpath
param.
Just got back to playing with this a bit more -- I've found that using a classpath that only references to
android-stubs-src.jar
works if you give the process enough memory (
-Xmx16g
) but it still took 2hrs to execute vs ~8 minutes without type resolution enabled. Is this expected?
g

gammax

06/28/2021, 4:35 PM
Is this expected?
Nope is not imho. Have you compared with your Gradle execution time?
b

brent

06/28/2021, 8:00 PM
Gradle execution time is about 60minutes (with no cache).
FWIW; It's a large project - just under 1M lines of kotlin.
Last update, just as an FYI; testing on a CircleCI large instance (
2xlarge+
), giving the detekt java process 36g of RAML, execution without type resolution is <1min. And WITH type resolution is ~46minutes. So we're going to stick with the gradle plugin.