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

Implement ignoreAnnotated suppressor like detekt #1315

Closed
WebTiger89 opened this issue May 27, 2022 · 4 comments · Fixed by #1328
Closed

Implement ignoreAnnotated suppressor like detekt #1315

WebTiger89 opened this issue May 27, 2022 · 4 comments · Fixed by #1328
Labels
enhancement New feature or request epic Major feature, could be decomposed into smaller tasks good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@WebTiger89
Copy link

WebTiger89 commented May 27, 2022

There are a lot of false positive findings regarding Jetpack Compose. Detekt handles this gently with a ignoreAnnotated suppressor. It's a List of Strings. Code that is annotated with an annotation of this list is ignored.

This would come really handy for following rules:
TOO_MANY_PARAMETERS
LAMBDA_IS_NOT_LAST_PARAMETER
TOO_LONG_FUNCTION
FUNCTION_NAME_INCORRECT_CASE
VARIABLE_NAME_INCORRECT_FORMAT
MISSING_KDOC_ON_FUNCTION

@WebTiger89 WebTiger89 added the bug Something isn't working label May 27, 2022
@orchestr7
Copy link
Member

@WebTiger89 @Supress annotation is not enough for this scenario?

@WebTiger89
Copy link
Author

WebTiger89 commented May 27, 2022

I guess no. This feature is really handy and it might be required for my last suggestion (#1322)

I can imagine that this requires a lot of work but it would improve every rule not only the ones mentioned above.

Just have a look into:
detekt/detekt#4682

To fix this I use, but it looks terrible and is bad practice @SuppressWarnings("UnusedPrivateMember")

I can confirm what he means. Imagine @Supress annotations in almost every file in a android app module which is based on Jetpack Compose.

https://detekt.dev/docs/introduction/suppressors/#annotation-suppressor
detekt/detekt#4102

@orchestr7 orchestr7 added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers epic Major feature, could be decomposed into smaller tasks and removed bug Something isn't working labels May 27, 2022
@orchestr7
Copy link
Member

I got it, yeah. Actually it is a quick fix for us

@orchestr7 orchestr7 added this to the 1.1.1 milestone May 27, 2022
@orchestr7 orchestr7 linked a pull request May 29, 2022 that will close this issue
@orchestr7
Copy link
Member

orchestr7 commented May 30, 2022

We made even more: except the suppression of blocks that are marked with specific annotations, we also aded @Suppress("diktat") that will remove all check for this particular block of code.
#1328

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request epic Major feature, could be decomposed into smaller tasks good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants