Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle StyleCop.Analyzers and our custom Faithlife stylecop.ruleset into Faithlife.Analyzers #53

Open
NateMerritt opened this issue Feb 21, 2019 · 5 comments

Comments

@NateMerritt
Copy link

https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/Configuration.md#sharing-configuration-among-solutions describes how to package a stylecop.ruleset file in order to share it among multiple solutions. This issue is to add StyleCop.Analyzers 1.0.2 (most recent at the time this issue was created) as a nuget dependency to Faithlife.Analyzers and bundle in a Faithlife stylecop.ruleset with our styling guidelines.

Concerns:

  • Does it make sense to bundle in style issues with Faithlife.Analyzers?
  • Do all teams working in C# at Faithlife agree on one set of style rules?

Here's a stylecop.ruleset file already in use at Faithlife that can serve as a discussion starter (currently used by multiple teams):

<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Faithlife Custom Rules" Description="Based on the Microsoft Minimum Recommended Rules. These rules focus on the most critical problems in your code, including potential security holes, application crashes, and other important logic and design errors. It is recommended to include this rule set in any custom rule set you create for your projects." ToolsVersion="14.0">
  <Localization ResourceAssembly="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.dll" ResourceBaseName="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.Localized">
    <Name Resource="MinimumRecommendedRules_Name" />
    <Description Resource="MinimumRecommendedRules_Description" />
  </Localization>
  <Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
    <Rule Id="CA1001" Action="Warning" />
    <Rule Id="CA1003" Action="None" />
    <Rule Id="CA1009" Action="None" />
    <Rule Id="CA1012" Action="Warning" />
    <Rule Id="CA1013" Action="Warning" />
    <Rule Id="CA1032" Action="None" />
    <Rule Id="CA1033" Action="Warning" />
    <Rule Id="CA1038" Action="Warning" />
    <Rule Id="CA1041" Action="Warning" />
    <Rule Id="CA1043" Action="Warning" />
    <Rule Id="CA1044" Action="None" />
    <Rule Id="CA1046" Action="Warning" />
    <Rule Id="CA1047" Action="Warning" />
    <Rule Id="CA1048" Action="Warning" />
    <Rule Id="CA1049" Action="Warning" />
    <Rule Id="CA1050" Action="Warning" />
    <Rule Id="CA1051" Action="Warning" />
    <Rule Id="CA1052" Action="Warning" />
    <Rule Id="CA1053" Action="Warning" />
    <Rule Id="CA1058" Action="Warning" />
    <Rule Id="CA1060" Action="Warning" />
    <Rule Id="CA1061" Action="Warning" />
    <Rule Id="CA1063" Action="Warning" />
    <Rule Id="CA1064" Action="Warning" />
    <Rule Id="CA1065" Action="Warning" />
    <Rule Id="CA1301" Action="Warning" />
    <Rule Id="CA1307" Action="None" />
    <Rule Id="CA1309" Action="None" />
    <Rule Id="CA1400" Action="Warning" />
    <Rule Id="CA1401" Action="Warning" />
    <Rule Id="CA1403" Action="Warning" />
    <Rule Id="CA1404" Action="Warning" />
    <Rule Id="CA1410" Action="Warning" />
    <Rule Id="CA1415" Action="Warning" />
    <Rule Id="CA1500" Action="Warning" />
    <Rule Id="CA1502" Action="None" />
    <Rule Id="CA1504" Action="Warning" />
    <Rule Id="CA1505" Action="None" />
    <Rule Id="CA1708" Action="Warning" />
    <Rule Id="CA1711" Action="None" />
    <Rule Id="CA1712" Action="Warning" />
    <Rule Id="CA1713" Action="Warning" />
    <Rule Id="CA1714" Action="None" />
    <Rule Id="CA1715" Action="Warning" />
    <Rule Id="CA1717" Action="None" />
    <Rule Id="CA1719" Action="Warning" />
    <Rule Id="CA1721" Action="None" />
    <Rule Id="CA1722" Action="Warning" />
    <Rule Id="CA1724" Action="None" />
    <Rule Id="CA1725" Action="Warning" />
    <Rule Id="CA1800" Action="None" />
    <Rule Id="CA1801" Action="Warning" />
    <Rule Id="CA1802" Action="Warning" />
    <Rule Id="CA1804" Action="Warning" />
    <Rule Id="CA1806" Action="None" />
    <Rule Id="CA1809" Action="None" />
    <Rule Id="CA1811" Action="None" />
    <Rule Id="CA1813" Action="None" />
    <Rule Id="CA1821" Action="Warning" />
    <Rule Id="CA1822" Action="None" />
    <Rule Id="CA1823" Action="Warning" />
    <Rule Id="CA1900" Action="Warning" />
    <Rule Id="CA1901" Action="Warning" />
    <Rule Id="CA2000" Action="None" />
    <Rule Id="CA2002" Action="Warning" />
    <Rule Id="CA2101" Action="Warning" />
    <Rule Id="CA2104" Action="None" />
    <Rule Id="CA2108" Action="Warning" />
    <Rule Id="CA2111" Action="Warning" />
    <Rule Id="CA2112" Action="Warning" />
    <Rule Id="CA2114" Action="None" />
    <Rule Id="CA2116" Action="Warning" />
    <Rule Id="CA2117" Action="Warning" />
    <Rule Id="CA2121" Action="Warning" />
    <Rule Id="CA2122" Action="Warning" />
    <Rule Id="CA2123" Action="Warning" />
    <Rule Id="CA2124" Action="Warning" />
    <Rule Id="CA2126" Action="Warning" />
    <Rule Id="CA2131" Action="Warning" />
    <Rule Id="CA2132" Action="Warning" />
    <Rule Id="CA2133" Action="Warning" />
    <Rule Id="CA2134" Action="Warning" />
    <Rule Id="CA2137" Action="Warning" />
    <Rule Id="CA2138" Action="Warning" />
    <Rule Id="CA2140" Action="Warning" />
    <Rule Id="CA2141" Action="Warning" />
    <Rule Id="CA2146" Action="Warning" />
    <Rule Id="CA2147" Action="Warning" />
    <Rule Id="CA2149" Action="Warning" />
    <Rule Id="CA2200" Action="Warning" />
    <Rule Id="CA2201" Action="Info" />
    <Rule Id="CA2207" Action="Warning" />
    <Rule Id="CA2208" Action="Warning" />
    <Rule Id="CA2211" Action="Warning" />
    <Rule Id="CA2212" Action="Warning" />
    <Rule Id="CA2213" Action="Warning" />
    <Rule Id="CA2214" Action="Warning" />
    <Rule Id="CA2215" Action="Warning" />
    <Rule Id="CA2216" Action="Warning" />
    <Rule Id="CA2217" Action="Warning" />
    <Rule Id="CA2218" Action="Warning" />
    <Rule Id="CA2219" Action="Warning" />
    <Rule Id="CA2220" Action="Warning" />
    <Rule Id="CA2222" Action="Warning" />
    <Rule Id="CA2224" Action="Warning" />
    <Rule Id="CA2226" Action="Warning" />
    <Rule Id="CA2229" Action="Warning" />
    <Rule Id="CA2230" Action="Warning" />
    <Rule Id="CA2231" Action="Warning" />
    <Rule Id="CA2232" Action="Warning" />
    <Rule Id="CA2235" Action="Warning" />
    <Rule Id="CA2236" Action="Warning" />
    <Rule Id="CA2238" Action="Warning" />
    <Rule Id="CA2240" Action="Warning" />
    <Rule Id="CA2241" Action="Warning" />
    <Rule Id="CA2242" Action="Warning" />
  </Rules>
  <Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
    <Rule Id="SA1003" Action="None" />
    <Rule Id="SA1008" Action="None" />
    <Rule Id="SA1009" Action="None" />
    <Rule Id="SA1027" Action="None" />
    <Rule Id="SA1101" Action="None" />
    <Rule Id="SA1111" Action="None" />
    <Rule Id="SA1116" Action="None" />
    <Rule Id="SA1117" Action="None" />
    <Rule Id="SA1118" Action="None" />
    <Rule Id="SA1122" Action="None" />
    <Rule Id="SA1124" Action="Info" />
    <Rule Id="SA1133" Action="None" />
    <Rule Id="SA1134" Action="None" />
    <Rule Id="SA1200" Action="None" />
    <Rule Id="SA1201" Action="None" />
    <Rule Id="SA1202" Action="Info" />
    <Rule Id="SA1204" Action="None" />
    <Rule Id="SA1303" Action="None" />
    <Rule Id="SA1308" Action="None" />
    <Rule Id="SA1310" Action="None" />
    <Rule Id="SA1311" Action="None" />
    <Rule Id="SA1402" Action="None" />
    <Rule Id="SA1407" Action="None" />
    <Rule Id="SA1503" Action="None" />
    <Rule Id="SA1516" Action="None" />
    <Rule Id="SA1604" Action="None" />
    <Rule Id="SA1611" Action="None" />
    <Rule Id="SA1614" Action="None" />
    <Rule Id="SA1615" Action="None" />
    <Rule Id="SA1618" Action="None" />
    <Rule Id="SA1623" Action="None" />
    <Rule Id="SA1633" Action="None" />
    <Rule Id="SA1642" Action="None" />
    <Rule Id="SA1643" Action="None" />
    <Rule Id="SA1652" Action="None" />
    <Rule Id="SX1101" Action="Warning" />
  </Rules>
</RuleSet>
@amanda-mitchell
Copy link
Contributor

I do like the idea of publishing a single shared configuration, which is consistent with @bgrainger's stated goal of unifying our .net build tooling.

However, I recommend that it should go in a separate package from this one, particularly as we have evidence that at least one organization other than Faithlife might be interested in using Faithlife.Analyzers.

@ejball
Copy link
Member

ejball commented Feb 21, 2019

Having a standard ruleset seems reasonable, especially since NoWarn can be used to ignore any that a particular project decides don't work for it.

@bgrainger
Copy link
Member

See also #36.

@bgrainger
Copy link
Member

@david-mitchell Are you suggesting a new (say) "Faithlife.Guidelines" package that would pull in Faithlife.Analyzers, StyleCop w/ rules, Roslynator w/ rules, any other libraries we find useful? So (if this is technically possible), adding one dependency pulls in a large set of different rules from various providers?

@amanda-mitchell
Copy link
Contributor

@bgrainger, that is my suggestion. Based on the NuGet documentation I've read, I believe that it's possible, but I have not tested it to verify my understanding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants