[Mono-dev] gendarme patch (bugfix): console runner and commenting some rules

Christian Birkl christian.birkl at gmail.com
Mon Aug 28 16:39:08 EDT 2006


Hi all,

attached a patch for gendarme's mono console runner, which fixes a small
"ClassCastException" when trying to run a rules.xml which contains commented
out (<!-- -->) elements.

Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060828/4d9ce7e9/attachment.html 
-------------- next part --------------
Index: ConsoleRunner.cs
===================================================================
--- ConsoleRunner.cs	(revision 64483)
+++ ConsoleRunner.cs	(working copy)
@@ -124,10 +124,10 @@
 			return false;
 
 		bool result = false;
-		foreach (XmlElement ruleset in doc.DocumentElement) {
+		foreach (XmlElement ruleset in doc.DocumentElement.SelectNodes("ruleset")) {
 			if (ruleset.Attributes["name"].Value != set)
 				continue;
-			foreach (XmlElement assembly in ruleset) {
+			foreach (XmlElement assembly in ruleset.SelectNodes("rules")) {
 				string include = GetAttribute (assembly, "include", "*");
 				string exclude = GetAttribute (assembly, "exclude", String.Empty);
 				string from = GetFullPath (GetAttribute (assembly, "from", String.Empty));


More information about the Mono-devel-list mailing list