Enable StyleCop during build
This commit is contained in:
Родитель
4bd17a7d66
Коммит
b78bb4b5a7
|
@ -3,5 +3,6 @@
|
|||
<package id="Microsoft.Web.SkipStrongNames" version="1.0.0" />
|
||||
<package id="OpenCover" version="4.5.1923" />
|
||||
<package id="ReportGenerator" version="1.9.0.0" />
|
||||
<package id="StyleCop" version="4.7.10.0" />
|
||||
<package id="xunit.runners" version="1.9.2" />
|
||||
</packages>
|
|
@ -7,6 +7,7 @@
|
|||
<BuildProperties>Platform=$(Platform);SolutionDir=$(SolutionDir)</BuildProperties>
|
||||
<BuildProperties Condition="'$(InternalsInvisible)' != ''">$(BuildProperties);InternalsInvisible=$(InternalsInvisible)</BuildProperties>
|
||||
<BuildProperties Condition="'$(RunCodeAnalysis)' != ''">$(BuildProperties);RunCodeAnalysis=$(RunCodeAnalysis)</BuildProperties>
|
||||
<BuildProperties Condition="'$(StyleCopEnabled)' != ''">$(BuildProperties);StyleCopEnabled=$(StyleCopEnabled)</BuildProperties>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -71,7 +72,7 @@
|
|||
LogStandardErrorAsError="true" />
|
||||
</Target>
|
||||
|
||||
<Target Name="Build">
|
||||
<Target Name="Build" DependsOnTargets="RestoreSolutionPackages">
|
||||
<MSBuild Targets="Build"
|
||||
Projects="@(ProjectToBuild)"
|
||||
Properties="Configuration=%(BuildConfiguration.Identity);$(BuildProperties)"
|
||||
|
@ -103,7 +104,7 @@
|
|||
<Target Name="Package">
|
||||
<MSBuild Targets="Rebuild"
|
||||
Projects="$(MSBuildThisFileFullPath)"
|
||||
Properties="Configuration=$(Configuration);$(BuildProperties);BuildCoreOnly=true;InternalsInvisible=true;RunCodeAnalysis=false" />
|
||||
Properties="Configuration=$(Configuration);$(BuildProperties);BuildCoreOnly=true;InternalsInvisible=true;RunCodeAnalysis=false;StyleCopEnabled=false" />
|
||||
<MSBuild Targets="Build"
|
||||
Projects="src\NuGet\NuGet.proj"
|
||||
Properties="Configuration=$(Configuration)"
|
||||
|
|
|
@ -182,26 +182,11 @@
|
|||
</Analyzer>
|
||||
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
|
||||
<Rules>
|
||||
<Rule Name="ElementsMustBeDocumented">
|
||||
<RuleSettings>
|
||||
<BooleanProperty Name="Enabled">False</BooleanProperty>
|
||||
</RuleSettings>
|
||||
</Rule>
|
||||
<Rule Name="PartialElementsMustBeDocumented">
|
||||
<RuleSettings>
|
||||
<BooleanProperty Name="Enabled">False</BooleanProperty>
|
||||
</RuleSettings>
|
||||
</Rule>
|
||||
<Rule Name="EnumerationItemsMustBeDocumented">
|
||||
<RuleSettings>
|
||||
<BooleanProperty Name="Enabled">False</BooleanProperty>
|
||||
</RuleSettings>
|
||||
</Rule>
|
||||
<Rule Name="ElementDocumentationMustHaveSummary">
|
||||
<RuleSettings>
|
||||
<BooleanProperty Name="Enabled">False</BooleanProperty>
|
||||
</RuleSettings>
|
||||
</Rule>
|
||||
<Rule Name="PartialElementDocumentationMustHaveSummary">
|
||||
<RuleSettings>
|
||||
<BooleanProperty Name="Enabled">False</BooleanProperty>
|
||||
|
@ -212,21 +197,6 @@
|
|||
<BooleanProperty Name="Enabled">False</BooleanProperty>
|
||||
</RuleSettings>
|
||||
</Rule>
|
||||
<Rule Name="ElementParametersMustBeDocumented">
|
||||
<RuleSettings>
|
||||
<BooleanProperty Name="Enabled">False</BooleanProperty>
|
||||
</RuleSettings>
|
||||
</Rule>
|
||||
<Rule Name="ElementReturnValueMustBeDocumented">
|
||||
<RuleSettings>
|
||||
<BooleanProperty Name="Enabled">False</BooleanProperty>
|
||||
</RuleSettings>
|
||||
</Rule>
|
||||
<Rule Name="GenericTypeParametersMustBeDocumented">
|
||||
<RuleSettings>
|
||||
<BooleanProperty Name="Enabled">False</BooleanProperty>
|
||||
</RuleSettings>
|
||||
</Rule>
|
||||
<Rule Name="GenericTypeParametersMustBeDocumentedPartialClass">
|
||||
<RuleSettings>
|
||||
<BooleanProperty Name="Enabled">False</BooleanProperty>
|
||||
|
@ -237,11 +207,6 @@
|
|||
<BooleanProperty Name="Enabled">False</BooleanProperty>
|
||||
</RuleSettings>
|
||||
</Rule>
|
||||
<Rule Name="DocumentationTextMustNotBeEmpty">
|
||||
<RuleSettings>
|
||||
<BooleanProperty Name="Enabled">False</BooleanProperty>
|
||||
</RuleSettings>
|
||||
</Rule>
|
||||
<Rule Name="DocumentationTextMustContainWhitespace">
|
||||
<RuleSettings>
|
||||
<BooleanProperty Name="Enabled">False</BooleanProperty>
|
||||
|
@ -318,7 +283,10 @@
|
|||
</RuleSettings>
|
||||
</Rule>
|
||||
</Rules>
|
||||
<AnalyzerSettings />
|
||||
<AnalyzerSettings>
|
||||
<BooleanProperty Name="IgnorePrivates">True</BooleanProperty>
|
||||
<BooleanProperty Name="IgnoreInternals">True</BooleanProperty>
|
||||
</AnalyzerSettings>
|
||||
</Analyzer>
|
||||
<Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules">
|
||||
<Rules>
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
<!-- This file is a stripped-down copy of StyleCop.Targets. The original is a
|
||||
component of StyleCop's MSBuild integration feature. -->
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<!-- Specify where tasks are implemented. -->
|
||||
<UsingTask AssemblyFile="..\packages\StyleCop.4.7.10.0\lib\StyleCop.dll" TaskName="StyleCopTask" />
|
||||
|
||||
<PropertyGroup>
|
||||
<BuildDependsOn>$(BuildDependsOn);StyleCop</BuildDependsOn>
|
||||
<RebuildDependsOn>StyleCopForceFullAnalysis;$(RebuildDependsOn)</RebuildDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<StyleCopForceFullAnalysis Condition="'$(StyleCopForceFullAnalysis)' == ''">false</StyleCopForceFullAnalysis>
|
||||
<StyleCopCacheResults Condition="'$(StyleCopCacheResults)' == ''">true</StyleCopCacheResults>
|
||||
<StyleCopTreatErrorsAsWarnings Condition="'$(StyleCopTreatErrorsAsWarnings)' == ''">true</StyleCopTreatErrorsAsWarnings>
|
||||
<StyleCopEnabled Condition="'$(StyleCopEnabled)' == ''">true</StyleCopEnabled>
|
||||
<StyleCopOverrideSettingsFile Condition="'$(StyleCopOverrideSettingsFile)' == ''"> </StyleCopOverrideSettingsFile>
|
||||
<StyleCopOutputFile Condition="'$(StyleCopOutputFile)' == ''">$(IntermediateOutputPath)StyleCopViolations.xml</StyleCopOutputFile>
|
||||
<!-- Specifying 0 will cause StyleCop to use the default violation count limit.
|
||||
Specifying any positive number will cause StyleCop to use that number as the violation count limit.
|
||||
Specifying any negative number will cause StyleCop to allow any number of violations without limit. -->
|
||||
<StyleCopMaxViolationCount Condition="'$(StyleCopMaxViolationCount)' == ''">0</StyleCopMaxViolationCount>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Define target: StyleCopForceFullAnalysis -->
|
||||
<Target Name="StyleCopForceFullAnalysis">
|
||||
<CreateProperty Value="true">
|
||||
<Output TaskParameter="Value" PropertyName="StyleCopForceFullAnalysis" />
|
||||
</CreateProperty>
|
||||
</Target>
|
||||
|
||||
<!-- Define target: StyleCop -->
|
||||
<Target Name="StyleCop" Condition="'$(StyleCopEnabled)' != 'false'">
|
||||
<Message Text="Forcing full StyleCop reanalysis." Condition="'$(StyleCopForceFullAnalysis)' == 'true'" Importance="Low" />
|
||||
|
||||
<!-- Determine what files should be checked. Take all Compile items, but exclude those that have
|
||||
set ExcludeFromStyleCop=true or ExcludeFromSourceAnalysis=true. -->
|
||||
<CreateItem Include="@(Compile)" Condition="('%(Compile.ExcludeFromStyleCop)' != 'true') and ('%(Compile.ExcludeFromSourceAnalysis)' != 'true')">
|
||||
<Output TaskParameter="Include" ItemName="StyleCopFiles" />
|
||||
</CreateItem>
|
||||
|
||||
<Message Text="Analyzing @(StyleCopFiles)" Importance="Low" />
|
||||
|
||||
<!-- Show list of what files should be excluded. checked. Take all Compile items, but exclude those that have
|
||||
set ExcludeFromStyleCop=true or ExcludeFromSourceAnalysis=true. -->
|
||||
<CreateItem Include="@(Compile)" Condition="('%(Compile.ExcludeFromStyleCop)' == 'true') or ('%(Compile.ExcludeFromSourceAnalysis)' == 'true')">
|
||||
<Output TaskParameter="Include" ItemName="StyleCopExcludedFiles" />
|
||||
</CreateItem>
|
||||
|
||||
<ItemGroup>
|
||||
<StyleCopFiles Remove="@(ExcludeFromStyleCop)" />
|
||||
</ItemGroup>
|
||||
|
||||
<Message Text="Excluding @(StyleCopExcludedFiles)" Importance="Normal" />
|
||||
|
||||
<!-- Run the StyleCop MSBuild task. -->
|
||||
<StyleCopTask
|
||||
ProjectFullPath="$(MSBuildProjectDirectory)"
|
||||
SourceFiles="@(StyleCopFiles)"
|
||||
AdditionalAddinPaths="@(StyleCopAdditionalAddinPaths)"
|
||||
ForceFullAnalysis="$(StyleCopForceFullAnalysis)"
|
||||
DefineConstants="$(DefineConstants)"
|
||||
TreatErrorsAsWarnings="$(StyleCopTreatErrorsAsWarnings)"
|
||||
CacheResults="$(StyleCopCacheResults)"
|
||||
OverrideSettingsFile="$(StyleCopOverrideSettingsFile)"
|
||||
OutputFile="$(StyleCopOutputFile)"
|
||||
MaxViolationCount="$(StyleCopMaxViolationCount)" />
|
||||
|
||||
<!-- Make output files cleanable -->
|
||||
<CreateItem Include="$(StyleCopOutputFile)">
|
||||
<Output TaskParameter="Include" ItemName="FileWrites" />
|
||||
</CreateItem>
|
||||
|
||||
<!-- Add the StyleCop.cache file to the list of files we've written - so they can be cleaned up on a Build Clean. -->
|
||||
<CreateItem Include="StyleCop.Cache" Condition="'$(StyleCopCacheResults)' == 'true'">
|
||||
<Output TaskParameter="Include" ItemName="FileWrites" />
|
||||
</CreateItem>
|
||||
</Target>
|
||||
</Project>
|
|
@ -35,6 +35,11 @@ Project global pre-settings.
|
|||
<OutputPath45>$([System.Text.RegularExpressions.Regex]::Replace('$(OutputPath)', 'Net40', '', System.Text.RegularExpressions.RegexOptions.IgnoreCase))</OutputPath45>
|
||||
<OutputPath40>$(OutputPath45.TrimEnd('\'))Net40\</OutputPath40>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
|
||||
<StyleCopOverrideSettingsFile>$(RepositoryRoot)Settings.StyleCop</StyleCopOverrideSettingsFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Use CustomAfterMicrosoftCommonTargets property (Microsoft.Common.targets) to inject project post-targets -->
|
||||
|
|
|
@ -16,6 +16,12 @@ Project global post-settings and targets.
|
|||
<NuSpecProperties>NuGetPackageVersion=$(NuGetPackageVersion);EFPackageVersion=$(EFPackageVersion)</NuSpecProperties>
|
||||
</PropertyGroup>
|
||||
</Target>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration45)' == 'Debug'">
|
||||
<StyleCopEnabled Condition="'$(StyleCopEnabled)' == ''">false</StyleCopEnabled>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="EF.stylecop.targets" Condition="Exists('..\packages\StyleCop.4.7.10.0\lib\StyleCop.dll')" />
|
||||
|
||||
<Import Project="$(CustomAfterEntityFrameworkTargets)" Condition="Exists('$(CustomAfterEntityFrameworkTargets)')" Label="Post-targets Build Extensibility Point." />
|
||||
</Project>
|
||||
|
|
Загрузка…
Ссылка в новой задаче