Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diktat should recognize Detekt-specific suppressions #1627

Open
0x6675636b796f75676974687562 opened this issue Mar 16, 2023 · 3 comments
Open
Assignees
Labels
enhancement New feature or request

Comments

@0x6675636b796f75676974687562
Copy link
Member

0x6675636b796f75676974687562 commented Mar 16, 2023

There's a lot of similarity between Diktat and Detekt checks, but the literals they're @Suppress'ed with are different, e.g.:

Diktat Detekt
MAGIC_NUMBER MagicNumber
TOO_MANY_PARAMETERS LongParameterList
TOO_LONG_FUNCTION LongMethod
LONG_LINE MaxLineLength

When both syntax checkers are enabled in the same project, this leads to extra verbose lists of @Suppress arguments, e.g.:

@Suppress("MAGIC_NUMBER", "MagicNumber")
fun f() {
    g(42)
}

Diktat should be Detekt-compatible and understand Detekt-specific check names.

Environment information

  • diktat version: 1.2.4.2

Related

@petertrr, @nulls, feel free to comment.

@kgevorkyan
Copy link
Member

Maybe not get attached specifically to detekt, but support some common configuration/interface for all rules, which will currently contain at least one field aliases, as suggested for literals in #1628?

Thus, we can add aliases not only for detekt but for some other tools?

Also, we could add some short names for long suppressions via such configuration

@Suppress("SOME_UGLY_AND_LONG_WARNING")
fun foo() {
}
@Suppress("SHORT_NAME")
fun foo() {
}

where SHORT_NAME could be the short alias for SOME_UGLY_AND_LONG_WARNING?

@0x6675636b796f75676974687562
Copy link
Member Author

@kgevorkyan, #1628 is not literal-specific, so if we proceed and implement it, each check will support aliases.

This particular task (#1627) is about the pre-defined list of aliases some checks may have.

@kgevorkyan
Copy link
Member

Oh, now I got it, good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants