本文介绍了如何在自定义代码分析器中向规则添加属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在组建一个自定义代码分析器来运行Visual Studio 2015解决方案,我想添加一个属性来按日期控制它。



在适当的位置,规则(或规则集)只适用于在设定日期或之后修改的代码。



这是可能的,哪里是最好的来源信息?



我的尝试:



广泛的在线研究没有产生任何结果。



我还在分析器中添加了一个新变量,其中设置了DiagnosticID但我无法在其他任何地方访问它。 />


新想法成型!如果我尝试传递它会怎么样?



更新

我尝试使用构造函数 - 没有快乐。现在我将尝试从配置中读取



以及下周...

CodeCracker检查某些内容喜欢<自动生成>在标题注释中跳过自动生成文件的扫描。









我正在考虑添加评论< QA-检查>当分析仪运行时。然后将一个预编译事件添加到编译器中以从修改后的代码中删除它。



将指示分析器跳过任何标记为< qa-checked>

I'm putting together a custom code analyzer to run against Visual Studio 2015 solutions and I would like to add a property to control it by date.

When in place then the rule (or rule set) would only be applied to code modified on or after the set date.

Is this possible and where are the best sources of information?

What I have tried:

Extensive online research that has yielded nothing.

I also added a new variable to the section of the analyzer where the DiagnosticID is set but I was not able to access it anywhere else.

New Idea Forming! What if I try passing it is as an argument?

Update
I tried that idea using a constructor - no joy. Now I will try reading from a config

And for next week...
CodeCracker checks for something like <auto-generated> in a header comment to skip scan on autogenerated files.
seen here

and on stackoverflow

I'm thinking of adding a comment <qa-checked> when the analyser runs. Then add a precompile event to the compiler to remove this from modified code.

The analyzer will be instructed to skip any code marked <qa-checked>

推荐答案


这篇关于如何在自定义代码分析器中向规则添加属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 03:12