Problems with FindBugs exclude filter

前端 未结 3 993
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-09 02:22

I am in the process of evaluating FindBugs and am trying to make use of the excludeFilter so that the tool does not process the test packages or the generated ejb stubs.

3条回答
  •  旧巷少年郎
    2021-02-09 02:46

    Regarding FindBugFilter,

    (just to be sure) are you sure you are considering the compiled class files directories, and not the sourcePath? (as mentioned in this SO answer).

    From the Java element name matching section:

    If the name attribute of Class, Method or Field starts with the ~ character the rest of attribute content is interpreted as a Java regular expression that is matched against the names of the Java element in question.

    Would the following regex be more accurate?

        
        
    
    • ".*\._.*" instead of ".*\.^_*" because the anchor is supposed to match at the start of the string the regex pattern is applied to.

    • ".*?EJS.*" instead of ".*EJS*" because the ? quantifier makes the matching lazy, avoiding to 'eat' EJS. (Plus "S*" means "0 or n S", which does not help here)

提交回复
热议问题