简体   繁体   English

编码声纳插件2.13

[英]Coding sonar Plugin 2.13

Is it possible to obtain rule failures on a resource, during "sensor" or "decorator" stage ? 在“传感器”或“装饰器”阶段,是否有可能在资源上获得规则失败? Specifically rule failure ID ? 具体的规则失败ID?

Maybe it can be obtained on some other stage of batch side, so that it would be possible to generate some additional metrics. 也许可以在批处理端的其他某个阶段获得它,从而有可能生成一些其他指标。

You can do so using the Context object that is given in Decorator#decorate(Resource resource, DecoratorContext context) method. 您可以使用Decorator#decorate(资源,DecoratorContext上下文)方法中提供的Context对象来执行此操作。

You can do context#getViolations() to get the violations on the resource. 您可以执行context#getViolations()以获取对资源的违规。

Note that you should add the following annotation on your decorator class: 请注意,您应该在装饰类上添加以下注释:

@DependsUpon(DecoratorBarriers.END_OF_VIOLATION_TRACKING) @DependsUpon(DecoratorBarriers。END_OF_VIOLATION_TRACKING)

This will make sure that your decorator gets executed after the violation tracking, so that you have all the violations. 这将确保您的装饰器在违规跟踪之后得到执行,以便您拥有所有违规情况。

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

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