简体   繁体   English

如何在grails codenarc插件中包含自定义规则

[英]How to include custom rules in the grails codenarc plugin

I have a set of custom rules for codenarc and they use inheritance and abstract classes to share some code. 我有一套针对codenarc的自定义规则,他们使用继承和抽象类来共享一些代码。 The question is how to use this rules without modifying codenarc and building the codenarc.jar myself or How to inject classes into codenarc in the the codenarc plugin . 问题是如何在不修改codenarc并自行构建codenarc.jar或如何在codenarc插件中将类注入codenarc的情况下使用此规则。

As far as I can tell it is no possible to use rule("file:path/to/MyCustomRule.groovy") because MyCustomRule inherits from AbstractCustomRule which is not loaded be default and cannot be loaded with rule() in the ruleset configuration. 据我所知,不可能使用rule("file:path/to/MyCustomRule.groovy")因为MyCustomRule继承自未加载的AbstractCustomRule是默认的,并且无法在规则集配置中加载rule() Maybe I am missing something here? 也许我在这里错过了一些东西?

There is the related issue GPCODENARC-32 but without updates for 2 years. 有相关问题GPCODENARC-32但没有更新2年。

根据链接的问题 ,这已通过允许脚本而不是类来解决。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM