How to configure Gradle findbugs plugin to provide more error description?

Is there a way to add or add a link to other error descriptions in the report?

I mean good explanations for errors, such as RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPEthose in GUI mode.

Some error headers are not immediately understood.

Description example:

RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE: the value is checked here to see if it is null, but this value cannot be null, it was previously dereferenced and if it was a null null pointer an exception would have occurred with earlier dereferencing. Essentially, this code and the previous dereference are not consistent with the value being null. Either the check is redundant, or the previous dereferencing is erroneous.

+4
source share
1 answer

You can use the Violation Gradle Plugin for this.

It can accumulate many reporting tools and represent them well in the build log.

...
se/bjurr/violations/lib/example/OtherClass.java
╔══════════╀════════════╀══════════╀══════╀════════════════════════════════════════════════════╗
β•‘ Reporter β”‚ Rule       β”‚ Severity β”‚ Line β”‚ Message                                            β•‘
╠══════════β•ͺ════════════β•ͺ══════════β•ͺ══════β•ͺ════════════════════════════════════════════════════╣
β•‘ Findbugs β”‚ MS_SHOULD_ β”‚ INFO     β”‚ 7    β”‚ Field isn't final but should be                    β•‘
β•‘          β”‚ BE_FINAL   β”‚          β”‚      β”‚                                                    β•‘
β•‘          β”‚            β”‚          β”‚      β”‚                                                    β•‘
β•‘          β”‚            β”‚          β”‚      β”‚    <p>                                             β•‘
β•‘          β”‚            β”‚          β”‚      β”‚ This static field public but not final, and        β•‘
β•‘          β”‚            β”‚          β”‚      β”‚ could be changed by malicious code or              β•‘
β•‘          β”‚            β”‚          β”‚      β”‚         by accident from another package.          β•‘
β•‘          β”‚            β”‚          β”‚      β”‚         The field could be made final to avoid     β•‘
β•‘          β”‚            β”‚          β”‚      β”‚         this vulnerability.</p>                    β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β•’
β•‘ Findbugs β”‚ NM_FIELD_N β”‚ INFO     β”‚ 6    β”‚ Field names should start with a lower case letter  β•‘
β•‘          β”‚ AMING_CONV β”‚          β”‚      β”‚                                                    β•‘
β•‘          β”‚ ENTION     β”‚          β”‚      β”‚                                                    β•‘
β•‘          β”‚            β”‚          β”‚      β”‚   <p>                                              β•‘
β•‘          β”‚            β”‚          β”‚      β”‚ Names of fields that are not final should be in mi β•‘
β•‘          β”‚            β”‚          β”‚      β”‚ xed case with a lowercase first letter and the fir β•‘
β•‘          β”‚            β”‚          β”‚      β”‚ st letters of subsequent words capitalized.        β•‘
β•‘          β”‚            β”‚          β”‚      β”‚ </p>                                               β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Summary of se/bjurr/violations/lib/example/OtherClass.java
╔══════════╀══════╀══════╀═══════╀═══════╗
β•‘ Reporter β”‚ INFO β”‚ WARN β”‚ ERROR β”‚ Total β•‘
╠══════════β•ͺ══════β•ͺ══════β•ͺ═══════β•ͺ═══════╣
β•‘ Findbugs β”‚ 2    β”‚ 0    β”‚ 0     β”‚ 2     β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β•’
β•‘          β”‚ 2    β”‚ 0    β”‚ 0     β”‚ 2     β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•§β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•


Summary
╔════════════╀══════╀══════╀═══════╀═══════╗
β•‘ Reporter   β”‚ INFO β”‚ WARN β”‚ ERROR β”‚ Total β•‘
╠════════════β•ͺ══════β•ͺ══════β•ͺ═══════β•ͺ═══════╣
β•‘ Checkstyle β”‚ 4    β”‚ 1    β”‚ 1     β”‚ 6     β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β•’
β•‘ Findbugs   β”‚ 2    β”‚ 2    β”‚ 5     β”‚ 9     β•‘
β•Ÿβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β•’
β•‘            β”‚ 6    β”‚ 3    β”‚ 6     β”‚ 15    β•‘
β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•§β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•§β•β•β•β•β•β•β•β•
0
source

Source: https://habr.com/ru/post/1618557/


All Articles