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

Ignore patterns with suppress_warnings #504

Merged
merged 1 commit into from
Jul 9, 2020

Conversation

lyriccoder
Copy link
Member

fix #462

@lyriccoder
Copy link
Member Author

lyriccoder commented Jul 9, 2020

Here is the file I tested the feature:
LottieImageAsset.txt

If I run aibolit by the aibolit check --filename ...\LottieImageAsset.java --full command, I get the output:

D:\target\0001\temp\LottieImageAsset.java score: 7.7
D:\target\0001\temp\LottieImageAsset.java[58]: Count If Return (P6: 4.90 1/4)
D:\target\0001\temp\LottieImageAsset.java[58]: Null check (P13: 1.40 2/4)
D:\target\0001\temp\LottieImageAsset.java[21]: Non final attribute (P12: 0.80 3/4)
D:\target\0001\temp\LottieImageAsset.java[11]: Non final class (P24: 0.60 4/4)
Total score: 7.70, files seen: 1, ncss 2
  1. If you replace the @SuppressWarnings({"aibolit.P23", "aibolit.P11"}) warning with @SuppressWarnings({"aibolit.P23", "aibolit.P24"}) at the 10th line, you won't see P24 pattern (suppress for the whole class declaration)

  2. If you replace 56th line with @SuppressWarnings({"aibolit.P6", "aibolit.P13"}), you will ignore P6, P13 patterns (for the whole function declaration)

  3. If you replace 20th line with @SuppressWarnings({"aibolit.P23", "aibolit.P12"}), you will ignore P12 pattern (for the field declaration)

So, 3 types annotations are supported: for a class, for a function and for a field:

If we want to ignore a single pattern, annotation is used the following way:
@SuppressWarnings("aibolit.P23")

@lyriccoder lyriccoder requested a review from acheshkov July 9, 2020 09:47
@acheshkov acheshkov requested a review from aravij July 9, 2020 09:48
aibolit/__main__.py Show resolved Hide resolved
@acheshkov
Copy link
Member

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Jul 9, 2020

@rultor merge

@acheshkov OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit d206272 into cqfn:master Jul 9, 2020
@acheshkov
Copy link
Member

@rultor release, tag=1.2.3rc1

@acheshkov acheshkov deleted the final_annotation branch July 9, 2020 11:48
@rultor
Copy link
Collaborator

rultor commented Jul 9, 2020

@rultor merge

@acheshkov Done! FYI, the full log is here (took me 16min)

@rultor
Copy link
Collaborator

rultor commented Jul 9, 2020

@rultor release, tag=1.2.3rc1

@acheshkov OK, I will release it now. Please check the progress here

@rultor
Copy link
Collaborator

rultor commented Jul 9, 2020

@rultor release, tag=1.2.3rc1

@acheshkov Done! FYI, the full log is here (took me 14min)

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

Successfully merging this pull request may close these issues.

SuppressWarnings annotation support
4 participants