Colton Idle
05/11/2023, 1:07 PMColor.*
or MaterialTheme.colors.*
in my codebase and instead stick to my custom colors I have defined. What's the best way to enforce this with Detekt?Brais Gabin
05/11/2023, 1:34 PMForbiddenImport
. It will not prevent you for use it with the full qualified. But normally that’s good enoughtColton Idle
05/11/2023, 1:36 PMforbiddenPatterns
to take a list of forbidden import patterns.Colton Idle
05/11/2023, 1:37 PMBrais Gabin
05/11/2023, 1:38 PMimports
instead of forbiddenPatterns
Brais Gabin
05/11/2023, 1:39 PMimports:
- value: 'Colors.'
reason: 'Use out custom colors `x.y.z` instead.'
- value: ...
Brais Gabin
05/11/2023, 1:40 PMColton Idle
05/11/2023, 1:45 PMColton Idle
05/11/2023, 2:05 PMx.y.Colors
?Colton Idle
05/11/2023, 2:05 PMBrais Gabin
05/11/2023, 2:06 PMBrais Gabin
05/11/2023, 2:07 PMx.y.Colors
would do the workBrais Gabin
05/11/2023, 2:07 PMBrais Gabin
05/11/2023, 2:08 PMColton Idle
05/11/2023, 2:20 PM