Well i forgot to attach the file. Here it is.

Donovan

On Wed, Mar 24, 2010 at 12:00 AM, Donovan Lee Wanhoy <
don.leewan...@gmail.com> wrote:

> > sorry I thought I had already asked you: could you please update
> functional tests as well so the problem is proven to be fixed and
> won't show up again?
>
> Hi,
>
> Here is another diff file with the fix, the test case and the test output.
> Let me know if these are okay or if I need to make any more changes.
>
> Thanks,
>
> Donovan Lee Wanhoy
>
> On Tue, Mar 23, 2010 at 3:42 AM, Sylvain Thénault <
> sylvain.thena...@logilab.fr> wrote:
>
>> On 22 mars 13:39, Donovan Lee Wanhoy wrote:
>> > Hi,
>>
>> Hi Donovan,
>>
>> > Here is a new diff file with the changes.
>>
>> sorry I thought I had already asked you: could you please update
>> functional tests as well so the problem is proven to be fixed and
>> won't show up again?
>>
>> --
>> Sylvain Thénault                               LOGILAB, Paris (France)
>> Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
>> Développement logiciel sur mesure:       http://www.logilab.fr/services
>> CubicWeb, the semantic web framework:    http://www.cubicweb.org
>>
>>
>
diff -r f5f084e5267a checkers/base.py
--- a/checkers/base.py	Thu Mar 04 12:12:32 2010 +0100
+++ b/checkers/base.py	Tue Mar 23 23:54:13 2010 -0400
@@ -428,7 +428,14 @@
         self._check_name(f_type, node.name, node)
         # docstring
         if self.config.no_docstring_rgx.match(node.name) is None:
-            self._check_docstring(f_type, node)
+            overridden = False
+            # check if node is from a method overridden by its ancestor
+            for ancestor in node.parent.frame().ancestors():
+                if node.name in ancestor and \
+                   isinstance(ancestor[node.name], astng.Function):
+                    overridden = True                
+            if not overridden:
+                self._check_docstring(f_type, node)   
         # check default arguments'value
         self._check_defaults(node)
         # check arguments name
diff -r f5f084e5267a test/input/func_c0111.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/input/func_c0111.py	Tue Mar 23 23:54:13 2010 -0400
@@ -0,0 +1,40 @@
+''' Test for inheritence '''
+
+class AAAA:
+    ''' class AAAA '''
+    
+    def __init__(self):
+        pass
+    
+    def method1(self):
+        ''' method 1 '''
+        print self 
+        
+    def method2(self):
+        # should print C0111 message
+        print self
+    
+    def method3(self):
+        ''' method 3 '''
+        print self
+
+class BBBB(AAAA):
+    ''' class BBBB '''
+    
+    def __init__(self):
+        AAAA.__init__(self)
+     
+    # should ignore docstring calling from class AAAA
+    def method1(self):
+        AAAA.method1(self)    
+    
+class CCCC(BBBB):
+    ''' class CCCC '''
+    
+    def __init__(self):
+        BBBB.__init__(self)
+    
+    # should ignore docstring since CCCC is inherited from BBBB which is 
+    # inherited from AAAA containing method3
+    def method3(self):
+        AAAA.method3(self)
diff -r f5f084e5267a test/messages/func_c0111.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/messages/func_c0111.txt	Tue Mar 23 23:54:13 2010 -0400
@@ -0,0 +1,1 @@
+C: 13:AAAA.method2: Missing docstring
\ No newline at end of file
_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to