【问题标题】:Spotbugs-filter classname-suffixSpotbugs-过滤器类名-后缀
【发布时间】:2018-05-19 07:58:24
【问题描述】:

如果你 create a filter XML-file 来了解这样的漏洞

  <?xml version="1.0" encoding="UTF-8"?>
  <FindBugsFilter xmlns="https://github.com/spotbugs/filter/3.0. ..."> 
   <Match><Class name="de.test.Test.ClassASuffix" /></Match>
  </FindBugsFilter>

它非常适合 java 类 ClassASuffix。 但是添加更多规则很乏味,例如

 <Match><Class name="de.test.Test.ClassASuffix" /></Match>
 <Match><Class name="de.test.Test.ClassBSuffix" /></Match>
 <Match><Class name="de.test.Test.ClassCSuffix" /></Match>

如何过滤掉所有带有 *Suffix 的类?

我已经尝试过some of these examples。 (如.*Test")但它就是行不通。

【问题讨论】:

  • 试试.*\.Test\..*.*Suffix
  • 第二个工作。我没有测试第一个,因为 test.Test 中有我要检查的类。

标签: java regex xml spotbugs


【解决方案1】:

这行得通:

<Match><Class name="~.*?Suffix.*" /></Match>

【讨论】:

    猜你喜欢
    • 2011-11-01
    • 2021-06-23
    • 1970-01-01
    • 2021-12-22
    • 1970-01-01
    • 2015-08-24
    • 2018-05-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多