Is there parameter for detekt or some setting, to skip check sources or specific sourse set if it haven't changed?
b
Brais Gabin
10/26/2022, 3:28 PM
There is not. And if you change a file any other file could fail. For example if you change a property from nullable to non-nullable every other file that uses that property should warn you that the usage of
?.
is not needed.
s
schalkms
10/26/2022, 8:12 PM
If you don’t use rules that require type resolution, you can do this with a Git commit hook, for instance. The following guide shows you how to set up this commit hook. Please note that we don’t recommend this type of usage.
What about the case when sources not changed at all between detekt task launches? Looks like in that case check can be skipped
In company, where i am working now, there is git-hook that are launch detekt before push, but more conveniently (and it has already became into my habits) to launch detekt from cli before push. As result i wait full check two times.
Looks like this setting can be useful for this case and can improve detekt experience.
Case kind of rare, but i sure, not so much
s
schalkms
10/28/2022, 5:49 PM
@iamthevoid how big is your project in lines of code? Do you run detekt with type resolution enabled from CLI? How long does detekt for a single run over your project take? I am asking this, because detekt is pretty fast, if you run it without type resolution.
i
iamthevoid
10/31/2022, 8:13 AM
Detect check takes about 50 seconds
s
schalkms
10/31/2022, 7:57 PM
Without more details, I'd say that's quite a big project.
Could you adapt your git-hook or your build files and check whether detekt ran on an already compiled project? Only if that's not the case, detekt will then actually run.