Merge pull request #7382 from Mailaender/stylecop-plus

Added support for StyleCop+
This commit is contained in:
Matthias Mailänder
2015-01-25 23:58:42 +01:00
21 changed files with 79 additions and 34 deletions

View File

@@ -129,7 +129,7 @@ namespace OpenRA.FileFormats
type = stream.ReadASCII(4); type = stream.ReadASCII(4);
} }
else else
throw new NotSupportedException("Vqa uses unknown Subtype : {0}".F(type)); throw new NotSupportedException("Vqa uses unknown Subtype: {0}".F(type));
} }
/*var length = */stream.ReadUInt16(); /*var length = */stream.ReadUInt16();

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
var console = new StyleCopConsole(null, false, null, null, true); var console = new StyleCopConsole(null, false, null, null, true);
var project = new CodeProject(0, projectPath, new Configuration(null)); var project = new CodeProject(0, projectPath, new Configuration(null));
foreach (var filePath in Directory.GetFiles(projectPath, "*.cs", SearchOption.AllDirectories)) foreach (var filePath in Directory.GetFiles(projectPath, "*.cs", SearchOption.AllDirectories).Where(p => !p.Contains(".Designer")))
console.Core.Environment.AddSourceCode(project, filePath, null); console.Core.Environment.AddSourceCode(project, filePath, null);
console.ViolationEncountered += OnViolationEncountered; console.ViolationEncountered += OnViolationEncountered;

View File

@@ -360,5 +360,35 @@
</Rules> </Rules>
<AnalyzerSettings /> <AnalyzerSettings />
</Analyzer> </Analyzer>
<Analyzer AnalyzerId="StyleCopPlus.StyleCopPlusRules">
<Rules>
<Rule Name="CheckAllowedIndentationCharacters">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CheckWhetherLastCodeLineIsEmpty">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeLineMustNotBeLongerThan">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="MethodMustNotContainMoreLinesThan">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="AdvancedNamingRules">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
</Analyzers> </Analyzers>
</StyleCopSettings> </StyleCopSettings>

View File

@@ -9,6 +9,14 @@ if (!(Test-Path "nuget.exe"))
(New-Object System.Net.WebClient).DownloadFile("http://nuget.org/nuget.exe", $target) (New-Object System.Net.WebClient).DownloadFile("http://nuget.org/nuget.exe", $target)
} }
if (!(Test-Path "StyleCopPlus.dll"))
{
echo "Fetching StyleCopPlus from NuGet."
./nuget.exe install StyleCopPlus.MSBuild -Version 4.7.49.5
cp StyleCopPlus.MSBuild.4.7.49.5/tools/StyleCopPlus.dll .
rmdir StyleCopPlus.MSBuild.4.7.49.5 -Recurse
}
if (!(Test-Path "StyleCop.dll")) if (!(Test-Path "StyleCop.dll"))
{ {
echo "Fetching StyleCop files from NuGet." echo "Fetching StyleCop files from NuGet."

View File

@@ -3,6 +3,13 @@
# Die on any error for Travis CI to automatically retry: # Die on any error for Travis CI to automatically retry:
set -e set -e
if [ ! -f StyleCopPlus.dll ]; then
echo "Fetching StyleCopPlus from nuget"
nuget install StyleCopPlus.MSBuild -Version 4.7.49.5
cp ./StyleCopPlus.MSBuild.4.7.49.5/tools/StyleCopPlus.dll .
rm -rf StyleCopPlus.MSBuild.4.7.49.5
fi
if [ ! -f StyleCop.dll ]; then if [ ! -f StyleCop.dll ]; then
echo "Fetching StyleCop files from nuget" echo "Fetching StyleCop files from nuget"
nuget install StyleCop.MSBuild -Version 4.7.49.0 nuget install StyleCop.MSBuild -Version 4.7.49.0