```ForbiddenImport``` hey, can I have this suppres...
# detekt
u
Copy code
ForbiddenImport
hey, can I have this suppressed at a import level - or is file level the only way? I need to suppress it due to 3rd party library api using such banned import - but then the file is not getting checked at all of other banned imports
u
how does that help? I have bunch of banned imports, and in this instance one of them is okay because reasons; can I have just the one ignored and rest run?
e
create the baseline with the imports you want ignored. when if any new banned imports are added, they will be flagged (because they're not in the baseline) but the ones in the baseline are suppressed
u
not sure if thats what I need the concrete situation is this 3rd party lib needs to take
org.json
types (I wrap the lib in one file, its not exposed anywhere else) and my rule is to ban
org.json
in favor of
kotlinx.serialization
does that still fit, please?
e
why wouldn't it work? baseline suppressions specific to a file and signature, e.g.
Copy code
<?xml version='1.0' encoding='UTF-8'?>
<SmellBaseline>
  <ManuallySuppressedIssues/>
  <CurrentIssues>
    <ID>ForbiddenImport:JsonCompat.kt$import org.json.JsonObject</ID>
  </CurrentIssues>
</SmellBaseline>
and don't apply to other files or other imports
u
but say another 3rd party lib comes along, then what, redo the baseline?
e
yes. it's just suppressions out-of-line instead of inside your code
thank you color 1