• <tfoot id='oMc1g'></tfoot>

    <i id='oMc1g'><tr id='oMc1g'><dt id='oMc1g'><q id='oMc1g'><span id='oMc1g'><b id='oMc1g'><form id='oMc1g'><ins id='oMc1g'></ins><ul id='oMc1g'></ul><sub id='oMc1g'></sub></form><legend id='oMc1g'></legend><bdo id='oMc1g'><pre id='oMc1g'><center id='oMc1g'></center></pre></bdo></b><th id='oMc1g'></th></span></q></dt></tr></i><div id='oMc1g'><tfoot id='oMc1g'></tfoot><dl id='oMc1g'><fieldset id='oMc1g'></fieldset></dl></div>

    • <bdo id='oMc1g'></bdo><ul id='oMc1g'></ul>
  • <small id='oMc1g'></small><noframes id='oMc1g'>

        <legend id='oMc1g'><style id='oMc1g'><dir id='oMc1g'><q id='oMc1g'></q></dir></style></legend>

        如何为 SonarQube 创建自己的 C# 自定义规则?

        How can I create my own C# custom rules for SonarQube?(如何为 SonarQube 创建自己的 C# 自定义规则?)

            <small id='BEZaz'></small><noframes id='BEZaz'>

            <i id='BEZaz'><tr id='BEZaz'><dt id='BEZaz'><q id='BEZaz'><span id='BEZaz'><b id='BEZaz'><form id='BEZaz'><ins id='BEZaz'></ins><ul id='BEZaz'></ul><sub id='BEZaz'></sub></form><legend id='BEZaz'></legend><bdo id='BEZaz'><pre id='BEZaz'><center id='BEZaz'></center></pre></bdo></b><th id='BEZaz'></th></span></q></dt></tr></i><div id='BEZaz'><tfoot id='BEZaz'></tfoot><dl id='BEZaz'><fieldset id='BEZaz'></fieldset></dl></div>

              <tfoot id='BEZaz'></tfoot>

              • <bdo id='BEZaz'></bdo><ul id='BEZaz'></ul>
                • <legend id='BEZaz'><style id='BEZaz'><dir id='BEZaz'><q id='BEZaz'></q></dir></style></legend>
                    <tbody id='BEZaz'></tbody>
                  本文介绍了如何为 SonarQube 创建自己的 C# 自定义规则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我一直在做一些研究.我发现了一个非常好的示例列表,但对于 其他 语言 这里.

                  I've been doing some research on it. What I found is a list of quite nice samples but for other languages here.

                  我还查看了 sonar-dotnet.但它看起来与其他实现不相似.

                  I also looked at sonar-dotnet. But it doesn't look similar to the other implementations.

                  最后,老实说,这可能是我最后一次机会了,我快速浏览了 FxCop 自定义规则,但我不确定哪种方法是正确的.

                  Finally, and to be honest probably my last chance, I took a quick look at FxCop Custom Rules and I'm not sure what would be the right way.

                  我想要做的只是一个基本的 c# 规则,可以像 this由声纳预定义.

                  What I'm trying to do is just a basic c# rule that can be reviewed like this predefined by sonar.

                  我的意思是,不合规代码合规解决方案.

                  推荐答案

                  您所指的sonar-custom-rules-examples都是用Java编写的,并且针对各种目标使用Java编写的解析器语言.C# 和 VB.NET 的 sonar-dotnet 分析器是使用 C# 编写的,使用 Roslyn 框架由微软提供.

                  The sonar-custom-rules-examples you pointed at are all written in Java and use parsers written in Java for the various target languages. The sonar-dotnet analyzers for C# and VB.NET are written in C# using the Roslyn framework provided by Microsoft.

                  如果您想为 C# 编写自己的自定义规则,那么编写 Roslyn 分析器绝对是最简单的方法(Roslyn 替换了现在已过时的 FxCop).但是,有许多免费的第三方 Roslyn 分析器可用,因此可能有人已经编写了至少一些您想要的规则.查看 NuGet 了解可用的内容.

                  If you want to write your own custom rules for C# then writing a Roslyn analyzer is definitely the easiest way to do it (Roslyn replaced FxCop, which is now obsolete). However, there are dozens of free third-party Roslyn analyzers available, so it's possible that someone has already written at least some of the rules you want. Have a look on NuGet to see what's available.

                  接下来,您希望 Roslyn 分析器提出的问题出现在 SonarQube 中.如果您使用的是新版本的 SonarQube (v7.4+)、SonarScanner for MSBuild (v4.4+) 和 SonarC# 插件 (v7.6+),那么第三方 Roslyn 分析器引发的问题将自动被导入为一般问题.有关详细信息,请参阅文档.

                  Next, you want issues raised by a Roslyn analyzer to appear in SonarQube. If you are using new-ish versions of SonarQube (v7.4+), the SonarScanner for MSBuild (v4.4+) and the SonarC# plugin (v7.6+), then issues raised by third-party Roslyn analyzers will automatically be imported as generic issues. See the docs for more info.

                  一般问题有几个重大限制,就像无法选择在 SonarQube UI 中运行的规则一样.如果您想要更全功能的体验(或者如果您使用的是旧版本的 SonarQube),您可以使用 SonarQube Roslyn SDK 生成一个自定义的 SonarQube 插件,该插件包装了 Roslyn 分析器.使用 SDK 很简单:它是一个针对 Roslyn 分析器运行的 exe,它会为您生成一个 SonarQube 插件 jar.

                  Generic issues have a couple of significant limitations, just as not being able to select which rules to run in the SonarQube UI. If you want a more full-featured experience (or if you are using an older version of SonarQube), you can use the SonarQube Roslyn SDK to generate a custom SonarQube plugin that wraps the Roslyn analyzer. Using the SDK is straightforward: it's an exe that you run against the Roslyn analyzer, and it generates a SonarQube plugin jar for you.

                  这篇关于如何为 SonarQube 创建自己的 C# 自定义规则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Adding and removing users from Active Directory groups in .NET(在 .NET 中的 Active Directory 组中添加和删除用户)
                  set equality in linq(在 linq 中设置相等)
                  HashSet conversion to List(HashSet 转换为 List)
                  How to set timeout for webBrowser navigate event(如何为 webBrowser 导航事件设置超时)
                  Test whether two IEnumerablelt;Tgt; have the same values with the same frequencies(测试两个IEnumerablelt;Tgt;具有相同频率的相同值)
                  How do you determine if two HashSets are equal (by value, not by reference)?(您如何确定两个 HashSet 是否相等(按值,而不是按引用)?)
                • <i id='peyIc'><tr id='peyIc'><dt id='peyIc'><q id='peyIc'><span id='peyIc'><b id='peyIc'><form id='peyIc'><ins id='peyIc'></ins><ul id='peyIc'></ul><sub id='peyIc'></sub></form><legend id='peyIc'></legend><bdo id='peyIc'><pre id='peyIc'><center id='peyIc'></center></pre></bdo></b><th id='peyIc'></th></span></q></dt></tr></i><div id='peyIc'><tfoot id='peyIc'></tfoot><dl id='peyIc'><fieldset id='peyIc'></fieldset></dl></div>

                  <tfoot id='peyIc'></tfoot>

                      <bdo id='peyIc'></bdo><ul id='peyIc'></ul>

                      <legend id='peyIc'><style id='peyIc'><dir id='peyIc'><q id='peyIc'></q></dir></style></legend>

                            <small id='peyIc'></small><noframes id='peyIc'>

                              <tbody id='peyIc'></tbody>