detekt/detekt

Support ktlint's suppression style in detekt-formatting

Aperta

#7699 aperta il 3 ott 2024

 (0 commenti) (3 reazioni) (0 assegnatari)Kotlin (834 fork)batch import
formattinghelp wantedimprovement

Metriche repository

Star
 (6942 stelle)
Metriche merge PR
 (Merge medio 4g 9h) (65 PR mergiate in 30 g)

Descrizione

Expected Behavior

ktlint suppressions are respected by detekt.

Current Behavior

ktlint's suppressions aren't respected by detekt.

Support should cover these formats: https://github.com/pinterest/ktlint/blob/ae796b60f9340492e12a720d514e9646a1e9d068/documentation/snapshot/docs/faq.md#how-do-i-suppress-errors-for-a-lineblockfile

Suppression types:

  • @Suppress("ktlint") suppresses all ktlint rules (we could extend this so we could do the same thing with our rule sets too?)
  • @Suppress("ktlint:rule-set-id:rule-id") suppresses a specific rule

Context

If someone moves from ktlint to detekt and uses ktlint suppressions they currently need to adjust them for detekt. It should be easier to move between detekt and ktlint & its wrappers.

Guida contributor