1. ホーム
  2. Java

undefined[sonar] sonar:デフォルトのスキャンルール

2022-02-07 06:33:37

取得元 https://www.cnblogs.com/gcgc/p/11451125.html

https://blog.csdn.net/liumiaocn/article/details/83550309

https://note.youdao.com/ynoteshare1/index.html?id=3c1e6a08a21ada4dfe0123281637e299&type=note(ノート

https://blog.csdn.net/liumiaocn/article/details/83550309

.

soanr rule java version            
enable disable status rule rule content disable reason
Enable ".equals()" should not be used to test the values of "Atomic" classes equals() method should not be used on data of atomic types (e.g. AtomicInteger, AtomicLong , AtomicBoolean).    
Enable "=+" should not be used instead of "+=" "=+" should not be used instead of "+=".    
Enable "==" and "! =" should not be used when "equals" is overridden If the equals method inherited from an object is not overridden, use the "== operator and the equals method to compare two objects that are equivalent, otherwise the equals operator cannot be used.    
Enable "@CheckForNull" or "@Nullable" should not be used on primitive types "@CheckForNull" or "@Nullable" annotation should not be used on primitive types (byte, short, int, long, float, double, boolean, char).    
Enabling "@Controller" classes that use "@SessionAttributes" must call "setComplete" on their "SessionStatus& quot; objects The "@Controller" class that uses the "@SessionAttributes" annotation must call "setComplete" on their "SessionStatus" objects " object.    
Enable "@Deprecated" code should not be used Code marked with the @Deprecated annotation should not be used.    
Enabling "@EnableAutoConfiguration" should be fine-uned @EnableAutoConfiguration" has the disadvantage that it may load and configure beans that the application will never use, thus consuming more CPU and RAM than is actually needed. @EnableAutoConfiguration should be configured to exclude all beans that the application does not need.    
Enabling "@Import"s should be preferred to "@ComponentScan"s Since @ComponentScan slows down project startup, the "@Import" annotation that is explicitly introduced into the jar package should be chosen over the "@ComponentScan"s" annotation. " annotation instead of the "@ComponentScan" annotation.    
Enable "@NonNull" values should not be set to null Fields modified by the @NonNull annotation cannot be assigned to null. Fields, parameters, and return values marked as @NotNull, @NonNull, or @NonNull are typically not checked for null values before use. Setting one of these values to null, or not setting such a class fieldin the constructor, may result in a nullpointerexception at runtime.    
Enable "@Override" should be used on overriding and implementing methods When overriding and implementing methods, the "@Override" annotation is required.    
Enable "@RequestMapping" methods should be "public" "@RequestMapping" annotations should be used on modifying public methods/classes.    
Enable "@RequestMapping" methods should specify HTTP method @RequestMapping should explicitly specify the type of HTTP request.    
Enable "@SpringBootApplication" and "@ComponentScan" should not be used in the default package "@SpringBootApplication" and "@ComponentScan" should not be used in the default package "@SpringBootApplication" quot; and "@ComponentScan" annotations should not be used in the default package.    
Enable "action" mappings should not have too many "forward" entries action mappings should not have too many "forward" entities.    
enable "Arrays.stream" should be used for primitive arrays Streams should be used on primitive arrays.    
Enable "Bean Validation" (JSR 380) should be properly configured "Bean Validation" (JSR 380) should be properly configured, without the @Valid annotation, Bean Validation will not work without the @Valid annotation.    
Enable "BigDecimal(double)" should not be used The BigDecimal(double) type should not be used for precision reasons, often the valueof() method is used to convert double type data.    
Enable "catch" clauses should do more than rethrow catch After catching an exception, it should not just throw the exception    
Enable "Class.forName()" should not load JDBC 4.0+ drivers "Class.forName()" should not load JDBC 4.0+ drivers    
Enable "clone" should not be overridden clone() method should not be overridden, overrides may lead to shallow cloning problems    
Enable "Cloneables" should implement "clone" The Cloneables interface needs to implement the clone() method    
Enable "close()" calls should not be redundant There should be no redundant close() method calls    
enable "collect" should be used with "Streams" instead of "list::add" when using Streams, collect should be used because the processes of collect are parallel and safe    
Enable "Collections.EMPTY_LIST", "EMPTY_MAP", and "EMPTY_SET" should not be used because "Collections. quot;, "EMPTY_MAP", and "EMPTY_SET" will return the default collection, which will cause the problem of missing steps for null returns, and is not recommended.    
Enable "compareTo" results should not be checked for specific values "compareTo" results should not be checked for specific values, usually check >0 or <0    
Enable "compareTo" should not be overloaded compareTo parameters should not exceed the declared number    
Enable "compareTo" should not return "Integer.MIN_VALUE" the return value of compareTo should not be Integer.MIN_VALUE    
Enable "DateUtils.truncate" from Apache Commons Lang library should not be used Apache Commons Lang's date interception method DateUtils.truncate() does not round and should not be used    
Enable "default" clauses should be last switch in which default should be put last    
Enable "DefaultMessageListenerContainer" instances should not drop messages during restarts DefaultMessageListenerContainer instances should not Delete messages    
Enable "deleteOnExit" should not be used java programs have their own recycling mechanism after execution and do not need to recycle temporary files with deleteOnExit    
Enable "Double.longBitsToDouble" should not be used for "int" conversion of int type data to lone double will have accuracy problems and should not be used in this way    
enable "entrySet()" should be iterated when both the key and value are needed in the need to get the key in the map