How to disable Sonar rules for specific files?

后端 未结 6 796
囚心锁ツ
囚心锁ツ 2021-01-03 21:35

I\'ve got a project I\'m working on and some of the files violate some of the rules, but in ways that are not real issues, and are thus distracting noise. However, I don\'t

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-03 22:16

    Using below annotation we can ignore the rule from the specific files

    For one rule

    @java.lang.SuppressWarnings("squid:S2696")
    @Slf4j
    @Service
    public class PaymentServiceImpl implements PaymentService {....
    

    For more than one rule

    @java.lang.SuppressWarnings({"squid:S2696", "squid:S1172", "squid:CommentedOutCodeLine"})
    @Slf4j
    @Service
    public class PaymentServiceImpl implements PaymentService {...
    

提交回复
热议问题