规则将mdm从6.17.0升级到6.18.0时测试失败

问题描述 投票:0回答:1

规则是

“ // Reference [matches(@literal,\” ^ \ $ [^!] + \“)和./preceding-sibling::Text和./following-sibling::Text]”

为了方便起见,我将提供该项目,您可以对其进行mvn测试。

整个项目在https://github.com/XenoAmess/p3c/tree/1605f4d1b9c6a505074be5328953af26f578e190/p3c-pmd

Rule类为com.alibaba.p3c.pmd.lang.vm.rule.other.UseQuietReferenceNotationRule

我试图浏览您的更新日志,但没有发现任何相关。

感谢您的帮助。

pmd
1个回答
0
投票
您的规则UseQuietReferenceNotationRule检查文件名(UseQuietReferenceNotationRule.java:65),该文件名现在在单元测试中不再是“ n / a”,而是“ a”。您可以通过简单地将UT_FILE_NAME更改为“ a”来“修复”单元测试(请参见UseQuietReferenceNotationRule.java:45)。

或者,您可以更改规则以使用ctx.getSourceCodeFile().toString()恢复UseQuietReferenceNotationRule.java:62中的完整路径名。尽管该文件不存在,但仍指向“ n / a”。

用于检查规则本身中路径名称的替代方法可能是File exclusion/inclusion patterns

此外,如果您认为规则对更广泛的受众有意义,也欢迎对https://github.com/pmd/pmd做出贡献。

© www.soinside.com 2019 - 2024. All rights reserved.