From 7b5b14e0cf394a32db5d216509639f716e92652f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Fri, 2 Jan 2015 18:39:10 +0100 Subject: [PATCH 1/3] remove the spammy exit 0 output --- OpenRA.Mods.Common/UtilityCommands/CheckCodeStyle.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/OpenRA.Mods.Common/UtilityCommands/CheckCodeStyle.cs b/OpenRA.Mods.Common/UtilityCommands/CheckCodeStyle.cs index 2dfa356161..b4c36881bf 100644 --- a/OpenRA.Mods.Common/UtilityCommands/CheckCodeStyle.cs +++ b/OpenRA.Mods.Common/UtilityCommands/CheckCodeStyle.cs @@ -34,7 +34,6 @@ namespace OpenRA.Mods.Common.UtilityCommands foreach (var filePath in Directory.GetFiles(projectPath, "*.cs", SearchOption.AllDirectories)) console.Core.Environment.AddSourceCode(project, filePath, null); - console.OutputGenerated += OnOutputGenerated; console.ViolationEncountered += OnViolationEncountered; console.Start(new[] { project }, true); @@ -42,11 +41,6 @@ namespace OpenRA.Mods.Common.UtilityCommands Environment.Exit(1); } - void OnOutputGenerated(object sender, OutputEventArgs e) - { - Console.WriteLine(e.Output); - } - void OnViolationEncountered(object sender, ViolationEventArgs e) { violationCount++; From 1c90199fb00cf6dffb6cc5bd5d7ee8fe982baecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Fri, 2 Jan 2015 18:39:29 +0100 Subject: [PATCH 2/3] one everything is fine per project is enough --- OpenRA.Mods.Common/UtilityCommands/CheckCodeStyle.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/UtilityCommands/CheckCodeStyle.cs b/OpenRA.Mods.Common/UtilityCommands/CheckCodeStyle.cs index b4c36881bf..5deb23fa2a 100644 --- a/OpenRA.Mods.Common/UtilityCommands/CheckCodeStyle.cs +++ b/OpenRA.Mods.Common/UtilityCommands/CheckCodeStyle.cs @@ -27,7 +27,8 @@ namespace OpenRA.Mods.Common.UtilityCommands [Desc("DIRECTORY", "Check the *.cs source code files in a directory for code style violations.")] public void Run(ModData modData, string[] args) { - var projectPath = Path.GetFullPath(args[1]); + var relativePath = args[1]; + var projectPath = Path.GetFullPath(relativePath); var console = new StyleCopConsole(null, false, null, null, true); var project = new CodeProject(0, projectPath, new Configuration(null)); @@ -39,6 +40,8 @@ namespace OpenRA.Mods.Common.UtilityCommands if (violationCount > 0) Environment.Exit(1); + else + Console.WriteLine("No violations encountered in {0}.".F(relativePath)); } void OnViolationEncountered(object sender, ViolationEventArgs e) From 0f733d6b0df901b9ed8d2a50864dab8d95e6b093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Fri, 2 Jan 2015 18:40:05 +0100 Subject: [PATCH 3/3] absolute path is not of relevance and only junking up the logs --- OpenRA.Mods.Common/UtilityCommands/CheckCodeStyle.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/UtilityCommands/CheckCodeStyle.cs b/OpenRA.Mods.Common/UtilityCommands/CheckCodeStyle.cs index 5deb23fa2a..202c9efd1b 100644 --- a/OpenRA.Mods.Common/UtilityCommands/CheckCodeStyle.cs +++ b/OpenRA.Mods.Common/UtilityCommands/CheckCodeStyle.cs @@ -47,7 +47,8 @@ namespace OpenRA.Mods.Common.UtilityCommands void OnViolationEncountered(object sender, ViolationEventArgs e) { violationCount++; - Console.WriteLine("{0}:L{1}: [{2}] {3}", e.SourceCode.Path, e.LineNumber, e.Violation.Rule.CheckId, e.Message); + var path = e.SourceCode.Path.Replace(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar, ""); + Console.WriteLine("{0}:L{1}: [{2}] {3}", path, e.LineNumber, e.Violation.Rule.CheckId, e.Message); } } }