簡體   English   中英

為什么StyleCop分析儀不需要xml文檔

[英]Why does not StyleCop Analyzers require xml docunentation

我已經從舊的StyleCop VS擴展“升級”到StyleCop.Analyzers NuGet包。 更改之后,我不再收到有關缺少元素文檔的警告,但是我看到所有其他違反StyleCop的警告均是預期的警告(包括SA1633-要求文件頭)

我正在使用VS 2017,我的解決方案由幾個項目組成(這是一個具有Android和IOS目標的Xamarin Forms解決方案)。 我已盡力將StyleCop.Analyzers與一個共享的StyleCop.json文件合並(位於解決方案leven處,並將“作為鏈接”添加到每個單獨的項目。“構建操作”設置為所有項目中的AdditilaFiles)。共享的GlobalSupressions.cs(也作為常見解決方案級別文件的鏈接添加)。

GlobalSupression.cs包含兩個抑制:

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(
    "StyleCop.CSharp.SpacingRules", 
    "SA1028:Code must not contain trailing whitespace", 
    Justification = "New rule that requires too much work to implement")]

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(
    "StyleCop.CSharp.DocumentationRules",
    "SA1652:Enable XML documentation output",
    Justification = "Could not get copyright file header to work properly")] 

如果沒有最后一個樣式,StyleCop會為每個文件中的xml文件頭發出SA1652警告。 文件頭看起來像這樣:

// -----------------------------------------------------------------
// <copyright file="GlobalSuppressions.cs" company="MyCompany">
// Copyright (c) MyCompany. All rights reserved.
// </copyright>
// -----------------------------------------------------------------

我的StyleCop.json

{
  "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
  "settings": {
    "documentationRules": {
      "xmlHeader": true,
      "companyName": "MyCompany",
      "copyrightText": "Copyright (c) {companyName}. All rights reserved.",
      "headerDecoration": "-----------------------------------------------------------------",

      "documentInterfaces": true,
      "documentInternalElements": true,
      "documentExposedElements": true,
      "documentPrivateElements": true,
      "documentPrivateFields": true
    }
  }
}

我無法檢測到包括最后5行之間的任何區別。 沒有針對缺少的文檔發出警告(我知道有很多丟失的文檔)

卡托

升級到StyleCop.Analyzers 1.1 beta 4解決了該問題(僅對打開的文檔顯示警告)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM