Author: spouliot
Date: 2008-02-15 14:31:02 -0500 (Fri, 15 Feb 2008)
New Revision: 95800
Removed:
trunk/mono-tools/gendarme/framework/AssemblyManager.cs
trunk/mono-tools/gendarme/framework/IRule.cs
trunk/mono-tools/gendarme/framework/Location.cs
trunk/mono-tools/gendarme/framework/Message.cs
trunk/mono-tools/gendarme/framework/MessageCollection.cs
trunk/mono-tools/gendarme/framework/MessageType.cs
trunk/mono-tools/gendarme/framework/MinimalRunner.cs
trunk/mono-tools/gendarme/framework/RuleCollection.cs
trunk/mono-tools/gendarme/framework/RuleInformation.cs
trunk/mono-tools/gendarme/framework/RuleInformationManager.cs
trunk/mono-tools/gendarme/framework/Rules.cs
trunk/mono-tools/gendarme/framework/Runner.cs
trunk/mono-tools/gendarme/framework/Violation.cs
trunk/mono-tools/gendarme/framework/Violations.cs
Modified:
trunk/mono-tools/gendarme/framework/ChangeLog
trunk/mono-tools/gendarme/framework/Makefile.am
Log:
* Makefile.am: Adjust makefile with recent changes.
*.cs: Remove old fx classes.
2008-02-14 Sebastien Pouliot <[EMAIL PROTECTED]>
Deleted: trunk/mono-tools/gendarme/framework/AssemblyManager.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/AssemblyManager.cs 2008-02-15
19:29:38 UTC (rev 95799)
+++ trunk/mono-tools/gendarme/framework/AssemblyManager.cs 2008-02-15
19:31:02 UTC (rev 95800)
@@ -1,69 +0,0 @@
-//
-// Gendarme.Framework.AssemblyManager class
-//
-// Authors:
-// Sebastien Pouliot <[EMAIL PROTECTED]>
-//
-// Copyright (C) 2005 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
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.IO;
-using System.Reflection;
-using System.Text;
-
-using Mono.Cecil;
-
-namespace Gendarme.Framework {
-
- public static class AssemblyManager {
-
- static public MethodDefinition GetMethod (object method)
- {
- MethodDefinition md = (method as MethodDefinition);
- if (md != null)
- return md;
-
- MethodReference mr = (method as MethodReference);
- if (mr == null)
- return null;
-
- // convert the MethodReference into a MethodDefinition
- //AssemblyNameReference anr = (mr.DeclaringType.Scope
as AssemblyNameReference);
- return null;
-
- // TODO - Gendarme needs a list of "related" assemblies
to load so we can
- // return Definitions instead of References
- }
-
- static string defaultAssemblyLocation;
-
- static public string DefaultAssemblyLocation {
- get {
- if (defaultAssemblyLocation == null)
- defaultAssemblyLocation =
Path.GetDirectoryName (typeof (int).Assembly.Location);
- return defaultAssemblyLocation;
- }
- }
- }
-}
Modified: trunk/mono-tools/gendarme/framework/ChangeLog
===================================================================
--- trunk/mono-tools/gendarme/framework/ChangeLog 2008-02-15 19:29:38 UTC
(rev 95799)
+++ trunk/mono-tools/gendarme/framework/ChangeLog 2008-02-15 19:31:02 UTC
(rev 95800)
@@ -1,5 +1,10 @@
2008-02-14 Sebastien Pouliot <[EMAIL PROTECTED]>
+ * Makefile.am: Adjust makefile with recent changes.
+ *.cs: Remove old fx classes.
+
+2008-02-14 Sebastien Pouliot <[EMAIL PROTECTED]>
+
* Makefile.am: Add AssemblyResolver to the build.
2008-02-09 Nestor Salceda <[EMAIL PROTECTED]>
Deleted: trunk/mono-tools/gendarme/framework/IRule.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/IRule.cs 2008-02-15 19:29:38 UTC
(rev 95799)
+++ trunk/mono-tools/gendarme/framework/IRule.cs 2008-02-15 19:31:02 UTC
(rev 95800)
@@ -1,53 +0,0 @@
-//
-// Gendarme.Framework.IRule interface
-//
-// Authors:
-// Sebastien Pouliot <[EMAIL PROTECTED]>
-//
-// Copyright (C) 2005 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
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using Mono.Cecil;
-
-namespace Gendarme.Framework {
-
- public interface IRule {
- }
-
- public interface IAssemblyRule : IRule {
- MessageCollection CheckAssembly (AssemblyDefinition assembly,
Runner runner);
- }
-
- public interface IModuleRule : IRule {
- MessageCollection CheckModule (ModuleDefinition module, Runner
runner);
- }
-
- public interface ITypeRule : IRule {
- MessageCollection CheckType (TypeDefinition type, Runner
runner);
- }
-
- public interface IMethodRule : IRule {
- MessageCollection CheckMethod (MethodDefinition method, Runner
runner);
- }
-}
Deleted: trunk/mono-tools/gendarme/framework/Location.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/Location.cs 2008-02-15 19:29:38 UTC
(rev 95799)
+++ trunk/mono-tools/gendarme/framework/Location.cs 2008-02-15 19:31:02 UTC
(rev 95800)
@@ -1,85 +0,0 @@
-/*
- * Location.cs: an encapsulation of several pieces of information used
- * to identify a location in an assembly.
- *
- * Authors:
- * Aaron Tomb <[EMAIL PROTECTED]>
- * Sebastien Pouliot <[EMAIL PROTECTED]>
- *
- * Copyright (c) 2005 Aaron Tomb
- * Copyright (C) 2007 Novell, Inc (http://www.novell.com)
- *
- * This is free software, distributed under the MIT/X11 license.
- * See the included LICENSE.MIT file for details.
- **********************************************************************/
-
-using System;
-using System.Text;
-
-using Mono.Cecil;
-
-namespace Gendarme.Framework {
-
- public class Location {
- private string type;
- private string method;
- private int offset; // Offset of instruction into method
-
- public Location (TypeDefinition type)
- {
- if (type == null)
- throw new ArgumentNullException ("type");
-
- this.type = type.FullName;
- this.method = String.Empty;
- this.offset = -1;
- }
-
- public Location (MethodDefinition method) :
- this (method, -1)
- {
- }
-
- public Location (MethodDefinition method, int offset)
- {
- if (method == null)
- throw new ArgumentNullException ("method");
-
- this.type = method.DeclaringType.FullName;
- this.method = method.Name;
- this.offset = offset;
- }
-
- public Location (FieldDefinition field)
- {
- if (field == null)
- throw new ArgumentNullException ("field");
-
- this.type = field.DeclaringType.FullName;
- this.method = field.Name; // temporary
- this.offset = -1;
- }
-
- public override string ToString ()
- {
- StringBuilder sb = new StringBuilder ();
-
- if (!String.IsNullOrEmpty (type))
- sb.Append (type);
-
- if (!String.IsNullOrEmpty (method)) {
- if (sb.Length > 0)
- sb.Append ("::");
- sb.Append (method);
- }
-
- if (offset >= 0) {
- if (sb.Length > 0)
- sb.Append (":");
- sb.AppendFormat ("{0:x4}", offset);
- }
-
- return sb.ToString ();
- }
- }
-}
Modified: trunk/mono-tools/gendarme/framework/Makefile.am
===================================================================
--- trunk/mono-tools/gendarme/framework/Makefile.am 2008-02-15 19:29:38 UTC
(rev 95799)
+++ trunk/mono-tools/gendarme/framework/Makefile.am 2008-02-15 19:31:02 UTC
(rev 95800)
@@ -11,21 +11,34 @@
framework_sources_in = ../AssemblyInfo.cs.in
framework_generated_sources = $(framework_sources_in:.in=)
-framework_sources = AssemblyManager.cs IRule.cs RuleCollection.cs \
- RuleInformation.cs RuleInformationManager.cs \
- Rules.cs Runner.cs Violation.cs Violations.cs \
- Message.cs Location.cs MinimalRunner.cs \
- MessageCollection.cs MessageType.cs \
- Gendarme.Framework/AssemblyResolver.cs \
- Gendarme.Framework/MethodSignature.cs \
- Gendarme.Framework/MethodSignatures.cs \
- Gendarme.Framework/StackEntryAnalysis.cs \
- Gendarme.Framework.Rocks/AssemblyRocks.cs \
- Gendarme.Framework.Rocks/CommonRocks.cs \
- Gendarme.Framework.Rocks/CustomAttributeRocks.cs \
- Gendarme.Framework.Rocks/FieldRocks.cs \
- Gendarme.Framework.Rocks/MethodRocks.cs \
- Gendarme.Framework.Rocks/TypeRocks.cs
+framework_sources = \
+ Gendarme.Framework/AssemblyResolver.cs \
+ Gendarme.Framework/Confidence.cs \
+ Gendarme.Framework/Defect.cs \
+ Gendarme.Framework/DocumentationUriAttribute.cs \
+ Gendarme.Framework/IAssemblyRule.cs \
+ Gendarme.Framework/IMethodRule.cs \
+ Gendarme.Framework/IRule.cs \
+ Gendarme.Framework/IRunner.cs \
+ Gendarme.Framework/ITypeRule.cs \
+ Gendarme.Framework/ProblemAttribute.cs \
+ Gendarme.Framework/Rule.cs \
+ Gendarme.Framework/RuleResult.cs \
+ Gendarme.Framework/Runner.cs \
+ Gendarme.Framework/RunnerEventArgs.cs \
+ Gendarme.Framework/Severity.cs \
+ Gendarme.Framework/TestRunner.cs \
+ Gendarme.Framework/SolutionAttribute.cs \
+ Gendarme.Framework.Helpers/MethodSignature.cs \
+ Gendarme.Framework.Helpers/MethodSignatures.cs \
+ Gendarme.Framework.Helpers/StackEntryAnalysis.cs \
+ Gendarme.Framework.Rocks/AssemblyRocks.cs \
+ Gendarme.Framework.Rocks/CecilRocks.cs \
+ Gendarme.Framework.Rocks/CommonRocks.cs \
+ Gendarme.Framework.Rocks/CustomAttributeRocks.cs \
+ Gendarme.Framework.Rocks/FieldRocks.cs \
+ Gendarme.Framework.Rocks/MethodRocks.cs \
+ Gendarme.Framework.Rocks/TypeRocks.cs
framework_build_sources = $(addprefix $(srcdir)/, $(framework_sources))
framework_build_sources += $(framework_generated_sources)
@@ -37,11 +50,11 @@
cp $(CECIL_ASM) $(top_builddir)/gendarme/bin/
../bin/Gendarme.Framework.dll: ../bin/ $(framework_build_sources)
$(top_builddir)/gendarme/bin/Mono.Cecil.dll
- $(GMCS) -debug -target:library -doc:Gendarme.Framework.doc.xml
-langversion:linq -r:$(top_builddir)/gendarme/bin/Mono.Cecil.dll
-r:System.Xml.dll -out:$@ $(framework_build_sources)
+ $(GMCS) -debug -target:library
-r:$(top_builddir)/gendarme/bin/Mono.Cecil.dll -pkg:dotnet -out:$@
$(framework_build_sources)
framework_test_sources = \
- Gendarme.Framework/MethodSignatureTest.cs \
- Gendarme.Framework/StackEntryAnalysisTest.cs \
+ Gendarme.Framework.Helpers/MethodSignatureTest.cs \
+ Gendarme.Framework.Helpers/StackEntryAnalysisTest.cs \
Gendarme.Framework.Rocks/RocksTest.cs \
Gendarme.Framework.Rocks/AssemblyRocksTest.cs \
Gendarme.Framework.Rocks/CustomAttributeRocksTest.cs \
@@ -51,7 +64,7 @@
framework_test_build_sources = $(addprefix $(srcdir)/Test/,
$(framework_test_sources))
Test.Framework.dll: $(framework_test_build_sources) $(framework_rules_SCRIPTS)
../bin/Gendarme.Framework.dll $(top_builddir)/gendarme/bin/Mono.Cecil.dll
- $(GMCS) -debug -target:library -langversion:linq
-r:$(top_builddir)/gendarme/bin/Mono.Cecil.dll -pkg:mono-nunit
-r:../bin/Gendarme.Framework.dll \
+ $(GMCS) -debug -target:library
-r:$(top_builddir)/gendarme/bin/Mono.Cecil.dll -pkg:mono-nunit
-r:../bin/Gendarme.Framework.dll \
-out:$@ $(framework_test_build_sources)
test: Test.Framework.dll
Deleted: trunk/mono-tools/gendarme/framework/Message.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/Message.cs 2008-02-15 19:29:38 UTC
(rev 95799)
+++ trunk/mono-tools/gendarme/framework/Message.cs 2008-02-15 19:31:02 UTC
(rev 95800)
@@ -1,50 +0,0 @@
-/*
- * Message.cs: an error or warning message produced by a checker when it
- * discovers a problem.
- *
- * Authors:
- * Aaron Tomb <[EMAIL PROTECTED]>
- *
- * Copyright (c) 2005 Aaron Tomb and the contributors listed
- * in the ChangeLog.
- *
- * This is free software, distributed under the MIT/X11 license.
- * See the included LICENSE.MIT file for details.
- **********************************************************************/
-
-namespace Gendarme.Framework {
-
- public class Message {
-
- private string text;
- private Location location;
- private MessageType type;
-
- public Message (string text, Location location, MessageType
type)
- {
- this.text = text;
- this.location = location;
- this.type = type;
- }
-
- public string Text {
- get { return text; }
- }
-
- public Location Location {
- get { return location; }
- }
-
- public MessageType Type {
- get { return type; }
- }
-
- public override string ToString ()
- {
- if (location != null)
- return location.ToString () + ": " + text;
- else
- return text;
- }
- }
-}
Deleted: trunk/mono-tools/gendarme/framework/MessageCollection.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/MessageCollection.cs 2008-02-15
19:29:38 UTC (rev 95799)
+++ trunk/mono-tools/gendarme/framework/MessageCollection.cs 2008-02-15
19:31:02 UTC (rev 95800)
@@ -1,85 +0,0 @@
-//
-// Gendarme.Framework.MessageCollection class
-//
-// Authors:
-// Christian Birkl <[EMAIL PROTECTED]>
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-
-namespace Gendarme.Framework {
-
- /// <summary>
- /// Represents a typed collection of Messages
- /// </summary>
- public class MessageCollection : IEnumerable {
-
- private ArrayList innerList = new ArrayList ();
-
-
- public MessageCollection ()
- {
- }
-
- public MessageCollection (Message msg)
- : this ()
- {
- Add (msg);
- }
-
- /// <summary>
- /// Adds the given message to this collection
- /// </summary>
- /// <param name="message">message to be added</param>
- public void Add (Message message)
- {
- if (message == null)
- throw new ArgumentNullException ("message");
- innerList.Add (message);
- }
-
- /// <summary>
- /// Amount of messages
- /// </summary>
- public int Count {
- get { return innerList.Count; }
- }
-
- /// <summary>
- /// Clears this collection
- /// </summary>
- public void Clear ()
- {
- innerList.Clear ();
- }
-
- /// <summary>
- /// Returns an enumerator for this collection
- /// </summary>
- /// <returns>enumerator</returns>
- public IEnumerator GetEnumerator ()
- {
- return innerList.GetEnumerator ();
- }
- }
-}
Deleted: trunk/mono-tools/gendarme/framework/MessageType.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/MessageType.cs 2008-02-15 19:29:38 UTC
(rev 95799)
+++ trunk/mono-tools/gendarme/framework/MessageType.cs 2008-02-15 19:31:02 UTC
(rev 95800)
@@ -1,21 +0,0 @@
-/*
- * Message.cs: an error or warning message produced by a checker when it
- * discovers a problem.
- *
- * Authors:
- * Aaron Tomb <[EMAIL PROTECTED]>
- *
- * Copyright (c) 2005 Aaron Tomb and the contributors listed
- * in the ChangeLog.
- *
- * This is free software, distributed under the MIT/X11 license.
- * See the included LICENSE.MIT file for details.
- **********************************************************************/
-
-namespace Gendarme.Framework {
-
- public enum MessageType {
- Error,
- Warning
- }
-}
Deleted: trunk/mono-tools/gendarme/framework/MinimalRunner.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/MinimalRunner.cs 2008-02-15
19:29:38 UTC (rev 95799)
+++ trunk/mono-tools/gendarme/framework/MinimalRunner.cs 2008-02-15
19:31:02 UTC (rev 95800)
@@ -1,20 +0,0 @@
-/*
- * MinimalRunner.cs: A trivial extention of the Runner class, allowing
- * it to be instantiated.
- *
- * Authors:
- * Aaron Tomb <[EMAIL PROTECTED]>
- *
- * Copyright (c) 2005 Aaron Tomb and the contributors listed
- * in the ChangeLog.
- *
- * This is free software, distributed under the MIT/X11 license.
- * See the included LICENSE.MIT file for details.
- **********************************************************************/
-
-namespace Gendarme.Framework {
-
-public class MinimalRunner : Runner {
-}
-
-}
Deleted: trunk/mono-tools/gendarme/framework/RuleCollection.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/RuleCollection.cs 2008-02-15
19:29:38 UTC (rev 95799)
+++ trunk/mono-tools/gendarme/framework/RuleCollection.cs 2008-02-15
19:31:02 UTC (rev 95800)
@@ -1,55 +0,0 @@
-//
-// Gendarme.Framework.RuleCollection class
-//
-// Authors:
-// Sebastien Pouliot <[EMAIL PROTECTED]>
-//
-// Copyright (C) 2005 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
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-
-namespace Gendarme.Framework {
-
- public class RuleCollection : CollectionBase {
-
- internal RuleCollection ()
- {
- }
-
- public IRule this [int index] {
- get { return (IRule) List [index]; }
- set { List[index] = value; }
- }
-
- public void Add (IRule rule)
- {
- List.Add (rule);
- }
-
- public void Remove (IRule rule)
- {
- List.Remove (rule);
- }
- }
-}
Deleted: trunk/mono-tools/gendarme/framework/RuleInformation.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/RuleInformation.cs 2008-02-15
19:29:38 UTC (rev 95799)
+++ trunk/mono-tools/gendarme/framework/RuleInformation.cs 2008-02-15
19:31:02 UTC (rev 95800)
@@ -1,75 +0,0 @@
-//
-// Gendarme.Framework.RuleInformation class
-//
-// Authors:
-// Sebastien Pouliot <[EMAIL PROTECTED]>
-//
-// Copyright (C) 2005 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
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Text;
-
-namespace Gendarme.Framework {
-
- public class RuleInformation {
-
- static private RuleInformation empty = new RuleInformation ();
-
- private string name;
- private string uri;
- private string problem;
- private string solution;
-
- public RuleInformation ()
- {
- name = String.Empty;
- uri = String.Empty;
- problem = String.Empty;
- solution = String.Empty;
- }
-
- public string Name {
- get { return name; }
- set { name = value; }
- }
-
- public string Uri {
- get { return uri; }
- set { uri = value; }
- }
-
- public string Problem {
- get { return problem; }
- set { problem = value; }
- }
-
- public string Solution {
- get { return solution; }
- set { solution = value; }
- }
-
- static public RuleInformation Empty {
- get { return empty; }
- }
- }
-}
Deleted: trunk/mono-tools/gendarme/framework/RuleInformationManager.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/RuleInformationManager.cs
2008-02-15 19:29:38 UTC (rev 95799)
+++ trunk/mono-tools/gendarme/framework/RuleInformationManager.cs
2008-02-15 19:31:02 UTC (rev 95800)
@@ -1,143 +0,0 @@
-//
-// Gendarme.Framework.RuleInformationManager class
-//
-// Authors:
-// Sebastien Pouliot <[EMAIL PROTECTED]>
-//
-// Copyright (C) 2005 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
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.IO;
-using System.Collections;
-using System.Xml;
-
-namespace Gendarme.Framework {
-
- public class RuleInformationManager {
-
- private static Hashtable rules;
- private static Hashtable infos;
-
- static RuleInformationManager ()
- {
- }
-
- private RuleInformationManager ()
- {
- }
-
- static private XmlDocument LoadAssemblyRulesInformations
(string filename)
- {
- XmlDocument doc = null;
- if (rules == null) {
- rules = new Hashtable ();
- } else {
- doc = (XmlDocument) rules[filename];
- }
-
- if (doc == null) {
- doc = new XmlDocument ();
- if (File.Exists (filename)) {
- doc.Load (filename);
- }
- rules[filename] = doc;
- }
- return doc;
- }
-
- static private string GetAttribute (XmlElement xel, string name)
- {
- XmlAttribute xa = xel.Attributes[name];
- if (xa == null)
- return String.Empty;
- return xa.Value;
- }
-
- static private string GetSubElement (XmlElement xel, string
name)
- {
- if (xel.ChildNodes.Count > 0) {
- foreach (XmlElement child in xel.ChildNodes) {
- if (child.Name == name)
- return child.InnerText;
- }
- }
- return String.Empty;
- }
-
- static private RuleInformation LoadRuleInformations
(XmlDocument doc, string name)
- {
- RuleInformation ri = null;
- if (doc.DocumentElement != null) {
- foreach (XmlElement xel in doc.DocumentElement)
{
- if ((xel.Name == "rule") &&
(GetAttribute (xel, "Type") == name)) {
- ri = new RuleInformation ();
- ri.Name = GetAttribute (xel,
"Name");
- ri.Uri = GetAttribute (xel,
"Uri");
- ri.Problem = GetSubElement
(xel, "problem");
- ri.Solution = GetSubElement
(xel, "solution");
- }
- }
- }
-
- return (ri == null) ? RuleInformation.Empty : ri;
- }
-
- static public RuleInformation GetRuleInformation (Type type)
- {
- if (type == null)
- throw new ArgumentNullException ("rule");
-
- object o = null;
- if (infos == null) {
- infos = new Hashtable ();
- } else {
- o = infos[type.AssemblyQualifiedName];
- }
-
- if (o != null)
- return (o as RuleInformation);
-
- string fname = Path.ChangeExtension
(type.Assembly.Location, ".xml");
- if (rules == null) {
- rules = new Hashtable ();
- }
-
- XmlDocument doc = (XmlDocument) rules[fname];
- if (doc == null) {
- doc = LoadAssemblyRulesInformations (fname);
- }
-
- RuleInformation ri = LoadRuleInformations (doc,
type.AssemblyQualifiedName);
- infos[type.AssemblyQualifiedName] = ri;
- return ri;
- }
-
- static public RuleInformation GetRuleInformation (IRule rule)
- {
- if (rule == null)
- throw new ArgumentNullException ("rule");
-
- return GetRuleInformation (rule.GetType ());
- }
- }
-}
Deleted: trunk/mono-tools/gendarme/framework/Rules.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/Rules.cs 2008-02-15 19:29:38 UTC
(rev 95799)
+++ trunk/mono-tools/gendarme/framework/Rules.cs 2008-02-15 19:31:02 UTC
(rev 95800)
@@ -1,77 +0,0 @@
-//
-// Gendarme.Framework.Rules class
-//
-// Authors:
-// Sebastien Pouliot <[EMAIL PROTECTED]>
-//
-// Copyright (C) 2005 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
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Text;
-
-namespace Gendarme.Framework {
-
- public class Rules {
-
- private RuleCollection assemblyRules;
- private RuleCollection moduleRules;
- private RuleCollection typeRules;
- private RuleCollection methodRules;
-
- internal Rules ()
- {
- }
-
- public RuleCollection Assembly {
- get {
- if (assemblyRules == null)
- assemblyRules = new RuleCollection ();
- return assemblyRules;
- }
- }
-
- public RuleCollection Module {
- get {
- if (moduleRules == null)
- moduleRules = new RuleCollection ();
- return moduleRules;
- }
- }
-
- public RuleCollection Type {
- get {
- if (typeRules == null)
- typeRules = new RuleCollection ();
- return typeRules;
- }
- }
-
- public RuleCollection Method {
- get {
- if (methodRules == null)
- methodRules = new RuleCollection ();
- return methodRules;
- }
- }
- }
-}
Deleted: trunk/mono-tools/gendarme/framework/Runner.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/Runner.cs 2008-02-15 19:29:38 UTC
(rev 95799)
+++ trunk/mono-tools/gendarme/framework/Runner.cs 2008-02-15 19:31:02 UTC
(rev 95800)
@@ -1,180 +0,0 @@
-//
-// Gendarme.Framework.Runner class
-//
-// Authors:
-// Sebastien Pouliot <[EMAIL PROTECTED]>
-//
-// Copyright (C) 2005 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
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.IO;
-using System.Collections;
-using System.Reflection;
-
-using Mono.Cecil;
-
-namespace Gendarme.Framework {
-
- public abstract class Runner {
-
- private Rules rules;
- private ViolationCollection violations;
- private static MessageCollection failure = new
MessageCollection ();
- protected bool debug = false;
-
- public Rules Rules {
- get {
- if (rules == null)
- rules = new Rules ();
- return rules;
- }
- }
-
- public ViolationCollection Violations {
- get {
- if (violations == null)
- violations = new ViolationCollection ();
- return violations;
- }
- }
-
- public bool Debug {
- get {
- return debug;
- }
- }
-
- public MessageCollection RuleSuccess {
- get {
- return null;
- }
- }
-
- public MessageCollection RuleFailure {
- get {
- return failure;
- }
- }
-
- private static IRule CreateRuleFromType (Type type)
- {
- return (IRule) Activator.CreateInstance (type);
- }
-
- private static bool IsContainedInRuleSet (string rule, string
mask)
- {
- string[] ruleSet = mask.Split ('|');
- foreach (string entry in ruleSet) {
- if (String.Compare (rule, entry.Trim ()) == 0)
- return true;
- }
- return false;
- }
-
- public int LoadRulesFromAssembly (string assembly, string
includeMask, string excludeMask)
- {
- int total = 0;
- Assembly a = Assembly.LoadFile (Path.GetFullPath
(assembly));
- foreach (Type t in a.GetTypes ()) {
- if (t.IsAbstract || t.IsInterface)
- continue;
-
- if (includeMask != "*")
- if (!IsContainedInRuleSet (t.Name,
includeMask))
- continue;
-
- if ((excludeMask != null) &&
(excludeMask.Length > 0))
- if (IsContainedInRuleSet (t.Name,
excludeMask))
- continue;
-
- LoadRules (typeof (IAssemblyRule), t,
Rules.Assembly, ref total);
- LoadRules (typeof (IModuleRule), t,
Rules.Module, ref total);
- LoadRules (typeof (ITypeRule), t, Rules.Type,
ref total);
- LoadRules (typeof (IMethodRule), t,
Rules.Method, ref total);
- }
- return total;
- }
-
- static void LoadRules (Type rule, Type type, RuleCollection
rules, ref int count)
- {
- if (!rule.IsAssignableFrom (type))
- return;
-
- rules.Add (CreateRuleFromType (type));
- count++;
- }
-
- public void Process (AssemblyDefinition assembly)
- {
- CheckAssembly (assembly);
-
- foreach (ModuleDefinition module in assembly.Modules) {
- CheckModule (module);
-
- foreach (TypeDefinition type in module.Types)
- CheckType (type);
- }
- }
-
- void CheckAssembly (AssemblyDefinition assembly)
- {
- foreach (IAssemblyRule rule in Rules.Assembly)
- ProcessMessages (rule.CheckAssembly (assembly,
this), rule, assembly);
- }
-
- void CheckModule (ModuleDefinition module)
- {
- foreach (IModuleRule rule in Rules.Module)
- ProcessMessages (rule.CheckModule (module,
this), rule, module);
- }
-
- void CheckType (TypeDefinition type)
- {
- foreach (ITypeRule rule in Rules.Type)
- ProcessMessages (rule.CheckType (type, this),
rule, type);
-
- CheckMethods (type);
- }
-
- void CheckMethods (TypeDefinition type)
- {
- CheckMethods (type, type.Constructors);
- CheckMethods (type, type.Methods);
- }
-
- void CheckMethods (TypeDefinition type, ICollection methods)
- {
- foreach (MethodDefinition method in methods)
- foreach (IMethodRule rule in Rules.Method)
- ProcessMessages (rule.CheckMethod
(method, this), rule, method);
- }
-
- void ProcessMessages (MessageCollection messages, IRule rule,
object target)
- {
- if (messages == RuleSuccess)
- return;
-
- Violations.Add (rule, target, messages);
- }
- }
-}
Deleted: trunk/mono-tools/gendarme/framework/Violation.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/Violation.cs 2008-02-15 19:29:38 UTC
(rev 95799)
+++ trunk/mono-tools/gendarme/framework/Violation.cs 2008-02-15 19:31:02 UTC
(rev 95800)
@@ -1,82 +0,0 @@
-//
-// Gendarme.Framework.Violation class
-//
-// Authors:
-// Sebastien Pouliot <[EMAIL PROTECTED]>
-//
-// Copyright (C) 2005-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
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-using Mono.Cecil;
-
-namespace Gendarme.Framework {
-
- public struct Violation {
-
- private IRule rule;
- private object violator;
- private MessageCollection messages;
-
- public Violation (IRule rule, object violator,
MessageCollection messages)
- {
- this.rule = rule;
- this.violator = violator;
- this.messages = messages;
- }
-
- public AssemblyDefinition Assembly {
- get {
- AssemblyDefinition ad = (Violator as
AssemblyDefinition);
- if (ad != null)
- return ad;
-
- ModuleDefinition md = (Violator as
ModuleDefinition);
- if (md != null)
- return md.Assembly;
-
- TypeDefinition td = (Violator as
TypeDefinition);
- if (td != null)
- return td.Module.Assembly;
-
- MethodDefinition nd = (Violator as
MethodDefinition);
- if (nd != null)
- return nd.DeclaringType.Module.Assembly;
-
- return null;
- }
- }
-
- public MessageCollection Messages {
- get { return messages; }
- }
-
- public IRule Rule {
- get { return rule; }
- }
-
- public object Violator {
- get { return violator; }
- }
- }
-}
Deleted: trunk/mono-tools/gendarme/framework/Violations.cs
===================================================================
--- trunk/mono-tools/gendarme/framework/Violations.cs 2008-02-15 19:29:38 UTC
(rev 95799)
+++ trunk/mono-tools/gendarme/framework/Violations.cs 2008-02-15 19:31:02 UTC
(rev 95800)
@@ -1,80 +0,0 @@
-//
-// Gendarme.Framework.Violations class
-//
-// Authors:
-// Sebastien Pouliot <[EMAIL PROTECTED]>
-// Christian Birkl <[EMAIL PROTECTED]>
-//
-// Copyright (C) 2005, 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
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-
-namespace Gendarme.Framework {
-
- public class ViolationCollection : IEnumerable {
-
- private ArrayList list;
-
- internal ViolationCollection ()
- {
- }
-
- private IList List {
- get {
- if (list == null)
- list = new ArrayList ();
- return list;
- }
- }
-
- public int Count {
- get { return List.Count; }
- }
-
- public void Reset ()
- {
- list = null;
- }
-
- public void Add (IRule rule, object obj, MessageCollection
messages)
- {
- if (rule == null)
- throw new ArgumentNullException ("rule");
- if (obj == null)
- throw new ArgumentNullException ("obj");
-
- List.Add (new Violation (rule, obj, messages));
- }
-
- public void Add (Violation v)
- {
- List.Add (v);
- }
-
- public IEnumerator GetEnumerator ()
- {
- return List.GetEnumerator();
- }
- }
-}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches