Author: spouliot
Date: 2008-01-11 20:04:11 -0500 (Fri, 11 Jan 2008)
New Revision: 92705
Modified:
trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/ChangeLog
trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/ExitCodeIsLimitedOnUnixRule.cs
trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/FeatureRequiresRootPrivilegeOnUnixRule.cs
trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/MonoCompatibilityReviewRule.cs
trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/NewLineLiteralRule.cs
Log:
2008-01-11 Sebastien Pouliot <[EMAIL PROTECTED]>
* ExitCodeIsLimitedOnUnixRule.cs: Use new Location ctors.
* FeatureRequiresRootPrivilegeOnUnixRule.cs: Use new Location ctors.
* MonoCompatibilityReviewRule.cs: Use new Location ctors.
* NewLineLiteralRule.cs: Use new Location ctors.
Modified: trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/ChangeLog
===================================================================
--- trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/ChangeLog
2008-01-12 00:43:57 UTC (rev 92704)
+++ trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/ChangeLog
2008-01-12 01:04:11 UTC (rev 92705)
@@ -1,3 +1,10 @@
+2008-01-11 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * ExitCodeIsLimitedOnUnixRule.cs: Use new Location ctors.
+ * FeatureRequiresRootPrivilegeOnUnixRule.cs: Use new Location ctors.
+ * MonoCompatibilityReviewRule.cs: Use new Location ctors.
+ * NewLineLiteralRule.cs: Use new Location ctors.
+
2008-01-02 Sebastien Pouliot <[EMAIL PROTECTED]>
* ExitCodeIsLimitedOnUnixRule.cs: Rename InspectionResult[s]
Modified:
trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/ExitCodeIsLimitedOnUnixRule.cs
===================================================================
---
trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/ExitCodeIsLimitedOnUnixRule.cs
2008-01-12 00:43:57 UTC (rev 92704)
+++
trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/ExitCodeIsLimitedOnUnixRule.cs
2008-01-12 01:04:11 UTC (rev 92705)
@@ -157,7 +157,7 @@
messages = new
MessageCollection ();
Message message = null;
- Location loc = new Location
(method.DeclaringType.FullName, method.Name, current.Offset);
+ Location loc = new Location (method,
current.Offset);
if (results == InspectionResult.Unsure)
message = new Message ("In
Unix, unlike in Windows, process exit code can be a value between 0 and 255
inclusively. Be sure not to set it to values that are out of range.", loc,
MessageType.Warning);
else // bad
Modified:
trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/FeatureRequiresRootPrivilegeOnUnixRule.cs
===================================================================
---
trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/FeatureRequiresRootPrivilegeOnUnixRule.cs
2008-01-12 00:43:57 UTC (rev 92704)
+++
trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/FeatureRequiresRootPrivilegeOnUnixRule.cs
2008-01-12 01:04:11 UTC (rev 92705)
@@ -67,7 +67,7 @@
if (results == null)
results = new MessageCollection
();
- Location loc = new Location (fullname,
method.Name, ins.Offset);
+ Location loc = new Location (method,
ins.Offset);
Message msg = new Message ("Setting
Process.PriorityClass to something else than ProcessPriorityClass.Normal
requires root privileges.", loc, MessageType.Warning);
results.Add (msg);
break;
@@ -87,7 +87,7 @@
if (results == null)
results = new MessageCollection
();
- Location loc = new Location (fullname,
method.Name, ins.Offset);
+ Location loc = new Location (method,
ins.Offset);
Message msg = new Message ("Usage of
System.Net.NetworkInformation.Ping requires root privileges.", loc,
MessageType.Warning);
results.Add (msg);
break;
Modified:
trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/MonoCompatibilityReviewRule.cs
===================================================================
---
trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/MonoCompatibilityReviewRule.cs
2008-01-12 00:43:57 UTC (rev 92704)
+++
trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/MonoCompatibilityReviewRule.cs
2008-01-12 01:04:11 UTC (rev 92705)
@@ -142,7 +142,7 @@
results = new MessageCollection ();
error = string.Format (error, calledMethod, dict
[calledMethod]);
- Location loc = new Location
(method.DeclaringType.FullName, method.Name, ins.Offset);
+ Location loc = new Location (method, ins.Offset);
Message msg = new Message (error, loc, type);
results.Add (msg);
Modified:
trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/NewLineLiteralRule.cs
===================================================================
--- trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/NewLineLiteralRule.cs
2008-01-12 00:43:57 UTC (rev 92704)
+++ trunk/cecil/gendarme/rules/Gendarme.Rules.Portability/NewLineLiteralRule.cs
2008-01-12 01:04:11 UTC (rev 92705)
@@ -4,7 +4,7 @@
// Authors:
// Sebastien Pouliot <[EMAIL PROTECTED]>
//
-// Copyright (C) 2006-2007 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2006-2008 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -30,6 +30,7 @@
using Mono.Cecil;
using Mono.Cecil.Cil;
+
using Gendarme.Framework;
namespace Gendarme.Rules.Portability {
@@ -46,7 +47,6 @@
// rule applies
- string fullname = null;
MessageCollection results = null;
foreach (Instruction ins in method.Body.Instructions) {
switch (ins.OpCode.Code) {
@@ -57,19 +57,17 @@
continue;
if (s.IndexOfAny (InvalidChar) >= 0) {
- if (results == null) {
- results = new
MessageCollection ();
- fullname =
method.DeclaringType.FullName;
- }
-
- Location loc = new Location
(fullname, method.Name, ins.Offset);
+ Location loc = new Location
(method, ins.Offset);
// make the invalid char
visible on output
s = s.Replace ("\n", "\\n");
s = s.Replace ("\r", "\\r");
Message msg = new Message
(String.Format ("Found string: \"{0}\"", s),
loc,
MessageType.Warning);
- results.Add (msg);
+ if (results == null)
+ results = new
MessageCollection (msg);
+ else
+ results.Add (msg);
}
break;
default:
@@ -77,9 +75,6 @@
}
}
- if (results == null)
- return runner.RuleSuccess;
-
return results;
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches