Author: spouliot
Date: 2008-01-11 19:37:21 -0500 (Fri, 11 Jan 2008)
New Revision: 92701

Modified:
   trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/ChangeLog
   
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/DetectNonAlphaNumericsInTypeNamesRule.cs
   
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/EnumNotEndsWithEnumOrFlagsSuffixRule.cs
   trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UseCorrectCasingRule.cs
   trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UseCorrectPrefixRule.cs
   trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UseCorrectSuffixRule.cs
   trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UsePreferredTermsRule.cs
Log:
2008-01-11  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * DetectNonAlphaNumericsInTypeNamesRule.cs: Turn a method to static 
        and use new Location ctors.
        * EnumNotEndsWithEnumOrFlagsSuffixRule.cs: Use new Location ctors.
        * UseCorrectCasingRule.cs: Use new Location ctors.
        * UseCorrectPrefixRule.cs: Use new Location ctors.
        * UseCorrectSuffixRule.cs: Use new Location ctors.
        * UsePreferredTermsRule.cs: Use new Location ctors.



Modified: trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/ChangeLog
===================================================================
--- trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/ChangeLog  2008-01-12 
00:28:33 UTC (rev 92700)
+++ trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/ChangeLog  2008-01-12 
00:37:21 UTC (rev 92701)
@@ -1,3 +1,13 @@
+2008-01-11  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * DetectNonAlphaNumericsInTypeNamesRule.cs: Turn a method to static 
+       and use new Location ctors.
+       * EnumNotEndsWithEnumOrFlagsSuffixRule.cs: Use new Location ctors.
+       * UseCorrectCasingRule.cs: Use new Location ctors.
+       * UseCorrectPrefixRule.cs: Use new Location ctors.
+       * UseCorrectSuffixRule.cs: Use new Location ctors.
+       * UsePreferredTermsRule.cs: Use new Location ctors.
+
 2008-01-05  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * EnumNotEndsWithEnumOrFlagsSuffixRule.cs: Use rocks to reduce code

Modified: 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/DetectNonAlphaNumericsInTypeNamesRule.cs
===================================================================
--- 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/DetectNonAlphaNumericsInTypeNamesRule.cs
   2008-01-12 00:28:33 UTC (rev 92700)
+++ 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/DetectNonAlphaNumericsInTypeNamesRule.cs
   2008-01-12 00:37:21 UTC (rev 92701)
@@ -6,7 +6,7 @@
 //     Sebastien Pouliot <[EMAIL PROTECTED]>
 //
 // Copyright (c) <2007> Nidhi Rawal
-// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2007-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
@@ -36,8 +36,9 @@
 
        public class DetectNonAlphaNumericsInTypeNamesRule: IMethodRule, 
ITypeRule {
 
-               // Compiler generates an error for any other non alpha-numerics 
than underscore ('_'), so we just need to check the presence of underscore in 
method names
-               private bool CheckName (string name)
+               // Compiler generates an error for any other non alpha-numerics 
than underscore ('_'), 
+               // so we just need to check the presence of underscore in 
method names
+               private static bool CheckName (string name)
                {
                        return (name.IndexOf ("_") == -1);
                }
@@ -52,7 +53,7 @@
                        if (CheckName (type.Name))
                                return runner.RuleSuccess;
 
-                       Location location = new Location (type.FullName, 
type.Name, 0);
+                       Location location = new Location (type);
                        Message message = new Message ("Type name should not 
contain underscore.", location, MessageType.Error);
                        return new MessageCollection (message);
                }
@@ -67,7 +68,7 @@
                        if (CheckName (method.Name))
                                return runner.RuleSuccess;
 
-                       Location location = new Location 
(method.DeclaringType.ToString(), method.Name, 0);
+                       Location location = new Location (method);
                        Message message = new Message ("Method name should not 
contain an underscore.", location, MessageType.Error);
                        return new MessageCollection (message);
                }

Modified: 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/EnumNotEndsWithEnumOrFlagsSuffixRule.cs
===================================================================
--- 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/EnumNotEndsWithEnumOrFlagsSuffixRule.cs
    2008-01-12 00:28:33 UTC (rev 92700)
+++ 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/EnumNotEndsWithEnumOrFlagsSuffixRule.cs
    2008-01-12 00:37:21 UTC (rev 92701)
@@ -50,13 +50,13 @@
 
                        if (!typeDefinition.IsFlags ()) {
                                if (EndsWithSuffix ("Enum", 
typeDefinition.Name)) {
-                                       Location location = new Location 
(typeDefinition.FullName, typeDefinition.Name, 0);
+                                       Location location = new Location 
(typeDefinition);
                                        Message message = new Message ("Enum 
name should not end with the Enum suffix.", location, MessageType.Error);
                                        return new MessageCollection (message);
                                }
                        } else {
                                if (EndsWithSuffix ("Flags", 
typeDefinition.Name)) {
-                                       Location location = new Location 
(typeDefinition.FullName, typeDefinition.Name, 0);
+                                       Location location = new Location 
(typeDefinition);
                                        Message message = new Message ("Enum 
name should not end with the Flags suffix.", location, MessageType.Error);
                                        return new MessageCollection (message);
                                }

Modified: 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UseCorrectCasingRule.cs
===================================================================
--- trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UseCorrectCasingRule.cs    
2008-01-12 00:28:33 UTC (rev 92700)
+++ trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UseCorrectCasingRule.cs    
2008-01-12 00:37:21 UTC (rev 92701)
@@ -94,7 +94,7 @@
                        if (NamingUtils.IsNameGeneratedByCompiler 
(typeDefinition))
                                return runner.RuleSuccess;
 
-                       Location location = new Location 
(typeDefinition.FullName, typeDefinition.Name, 0);
+                       Location location = new Location (typeDefinition);
                        string errorMessage = string.Format ("By existing 
naming conventions, the type names should all be pascal-cased (e.g. MyClass). 
Rename '{0}' type to '{1}'.",
                                                             
typeDefinition.Name, PascalCase (typeDefinition.Name));
                        return new MessageCollection (new Message 
(errorMessage, location, MessageType.Error));
@@ -116,7 +116,7 @@
                        }
 
                        MessageCollection messages = new MessageCollection ();
-                       Location location = new Location 
(methodDefinition.DeclaringType.FullName, methodDefinition.Name, 0);
+                       Location location = new Location (methodDefinition);
 
                        // like types, methods/props should all be PascalCased, 
too
                        if (!IsPascalCase (name)) {

Modified: 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UseCorrectPrefixRule.cs
===================================================================
--- trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UseCorrectPrefixRule.cs    
2008-01-12 00:28:33 UTC (rev 92700)
+++ trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UseCorrectPrefixRule.cs    
2008-01-12 00:37:21 UTC (rev 92701)
@@ -52,7 +52,7 @@
 
                public MessageCollection CheckType (TypeDefinition 
typeDefinition, Runner runner)
                {
-                       Location location = new Location 
(typeDefinition.FullName, typeDefinition.Name, 0);
+                       Location location = new Location (typeDefinition);
                        if (typeDefinition.IsInterface) {
                                if (!IsCorrectInterfaceName 
(typeDefinition.Name)) { // interfaces should look like 'ISomething'
                                        Message message = new Message 
(string.Format ("The '{0}' interface name doesn't have the required 'I' prefix. 
Acoording to existing naming conventions, all interface names should begin with 
the 'I' letter followed by another capital letter.", typeDefinition.Name), 
location, MessageType.Error);

Modified: 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UseCorrectSuffixRule.cs
===================================================================
--- trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UseCorrectSuffixRule.cs    
2008-01-12 00:28:33 UTC (rev 92700)
+++ trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UseCorrectSuffixRule.cs    
2008-01-12 00:37:21 UTC (rev 92701)
@@ -107,7 +107,7 @@
 
                        RemoveDuplicates (ref proposedSuffixes);
                        // there must be some suffixes defined, but type name 
doesn't end with any of them
-                       Location location = new Location 
(typeDefinition.FullName, typeDefinition.Name, 0);
+                       Location location = new Location (typeDefinition);
                        string messageText;
                        if (proposedSuffixes.Count > 0) {
                                string joinedSuffixes = proposedSuffixes [0];

Modified: 
trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UsePreferredTermsRule.cs
===================================================================
--- trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UsePreferredTermsRule.cs   
2008-01-12 00:28:33 UTC (rev 92700)
+++ trunk/cecil/gendarme/rules/Gendarme.Rules.Naming/UsePreferredTermsRule.cs   
2008-01-12 00:37:21 UTC (rev 92701)
@@ -81,13 +81,13 @@
 
                public MessageCollection CheckType (TypeDefinition 
typeDefinition, Runner runner)
                {
-                       Location location = new Location 
(typeDefinition.FullName, typeDefinition.Name, 0);
+                       Location location = new Location (typeDefinition);
                        return CheckIdentifier (typeDefinition.Name, location, 
runner);
                }
 
                public MessageCollection CheckMethod (MethodDefinition 
methodDefinition, Runner runner)
                {
-                       Location location = new Location 
(methodDefinition.DeclaringType.FullName, methodDefinition.Name, 0);
+                       Location location = new Location (methodDefinition);
                        return CheckIdentifier (methodDefinition.Name, 
location, runner);
                }
        }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to