|
| 1 | +# This policy applies to the complete runnable documentation examples. |
| 2 | +# All compiler, correctness, security, performance and remaining style rules are inherited. |
| 3 | + |
| 4 | +[*.cs] |
| 5 | +# Explicit local types let readers understand a website block without following another method. |
| 6 | +# Keep the style analyzer enabled and configure it to enforce explicit types in these samples only. |
| 7 | +stylesharp.use_var = never |
| 8 | +stylesharp.SST2271.use_var = never |
| 9 | +csharp_style_var_for_built_in_types = false:suggestion |
| 10 | +csharp_style_var_when_type_is_apparent = false:suggestion |
| 11 | +csharp_style_var_elsewhere = false:suggestion |
| 12 | + |
| 13 | +# Documentation-specific exemptions belong only in the website documentation folder. |
| 14 | +# Complete source examples keep the inherited XML documentation diagnostics enabled. |
| 15 | + |
| 16 | +# Readers learn from concrete values ("Ada", "/imports/records", 10). Naming every literal as a constant only for |
| 17 | +# the analyzer sends them scrolling away from the line they are reading. |
| 18 | +dotnet_diagnostic.SST1486.severity = none |
| 19 | +dotnet_diagnostic.SST1471.severity = none |
| 20 | +# Samples show results as comments beside the line that produces them, which can look like commented-out code. |
| 21 | +dotnet_diagnostic.SST1148.severity = none |
| 22 | +# A sample's own "throw if the result is wrong" check is not part of an API contract that needs docs. |
| 23 | +dotnet_diagnostic.SST1662.severity = none |
| 24 | +# Samples build a client inline so the reader sees where it comes from; IHttpClientFactory is covered separately. |
| 25 | +dotnet_diagnostic.PSH1418.severity = none |
| 26 | + |
| 27 | +# Samples name the type they create ("new Person(1, \"Ada\")") so a reader never has to work out what "new(...)" builds. |
| 28 | +dotnet_diagnostic.SST2202.severity = none |
| 29 | +dotnet_diagnostic.IDE0090.severity = none |
| 30 | +# One initializer entry per line, with braces on their own lines, reads better in samples than one long line. |
| 31 | +dotnet_diagnostic.SST1531.severity = none |
| 32 | +# Samples call methods for their effect and ignore the value, as readers do; "_ =" discards only add noise here. |
| 33 | +dotnet_diagnostic.SST2221.severity = none |
| 34 | +dotnet_diagnostic.IDE0058.severity = none |
| 35 | +dotnet_diagnostic.CA1806.severity = none |
| 36 | +# [MethodImpl(AggressiveInlining)] on small sample helpers is performance tuning that distracts from what they show. |
| 37 | +dotnet_diagnostic.PSH1410.severity = none |
| 38 | +# A view starts its WhenActivated block in its constructor, which hands 'this' to ReactiveUI. That is the pattern |
| 39 | +# ReactiveUI documents for every view, so samples show it without a suppression attribute on each constructor. |
| 40 | +dotnet_diagnostic.SST2403.severity = none |
| 41 | + |
| 42 | +[TestingFrameworks/**/*.cs] |
| 43 | +# These tests are written for a beginner reading real test-framework code, not for API consumers browsing |
| 44 | +# IntelliSense: a plain "// Problem: ..." comment naming what the test is for reads better here than a |
| 45 | +# required /// doc comment on every [Fact]/[Test]/[TestMethod], and public test classes/methods do not need |
| 46 | +# XML docs (GenerateDocumentationFile is also off for these projects; see their .csproj). |
| 47 | +dotnet_diagnostic.SST1600.severity = none |
| 48 | +dotnet_diagnostic.SST1601.severity = none |
| 49 | +dotnet_diagnostic.SST1663.severity = none |
| 50 | +# A tiny record and JSON context used only by these tests do not need a [DebuggerDisplay]; that is |
| 51 | +# production-strictness these samples do not need. |
| 52 | +dotnet_diagnostic.SST2334.severity = none |
| 53 | +# xUnit's "pass TestContext.Current.CancellationToken" suggestion would make the xUnit project's tests differ |
| 54 | +# from the otherwise-identical NUnit/MSTest/TUnit versions just to satisfy one framework's analyzer. |
| 55 | +dotnet_diagnostic.xUnit1051.severity = none |
0 commit comments