gpt4 book ai didi

java - 向 "Methods should not have too many parameters"SonarQube 规则添加自定义异常(exception)

转载 作者:行者123 更新时间:2023-12-01 17:33:12 25 4
gpt4 key购买 nike

在 Sonar 规则中,有一个 S00107方法不应有太多参数”的规则。此规则对某些注释有异常(exception):

Exceptions

Methods annotated with Spring's @RequestMapping (and related shortcut annotations, like @GetRequest) or @JsonCreator may have a lot of parameters, encapsulation being possible. Such methods are therefore ignored.

是否可以为此异常添加其他注释?

我的情况:我有构造函数,由Lombok的@Builder注释,其中包含很多参数!所以我想忽略这些构造函数的这条规则。

public class MyClass extends MySupperClass {
@Builder
public MyClass(String a, int b, ..., String z) {
}
}

最佳答案

尝试添加 @SuppressWarnings("squid:S00107")

关于java - 向 "Methods should not have too many parameters"SonarQube 规则添加自定义异常(exception),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58621564/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com