Oke, if I have lint rule I can share it between mo...
# konsist
e
Oke, if I have lint rule I can share it between modules, how to achieve same with konsist?
☝️ 1
p
Make a separate module for Konsist "rules" and add it as a test-scoped dependency to all required modules. Something like https://kotlinlang.slack.com/archives/C05QG9FD6KS/p1717495568464869?thread_ts=1716988883.057399&cid=C05QG9FD6KS
e
Yeah, but I have to repeat test code that call that rule in every module, correct?
I can probably have shared source folder. Or maybe if I have app module that includes all other modules - I can add test for all code there.
i
No need to repeat Konsist test code. If you use
scopeFromProject
Konsist will check all files in the project (also consider
scopeFromProduction()
). You can create more granular scopes to check only files in given modules https://docs.konsist.lemonappdev.com/features/add-konsist-existing-project
👍 1
p
The best way to go is like Igor suggested. Use a dedicated Konsist module that contains all the checks. My approach makes more sense when using the same checks across multiple projects.
👍 2