Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 May 2013 21:09:47 +0000 (UTC)
From:      Chris Rees <crees@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r250194 - user/crees/rclint
Message-ID:  <201305022109.r42L9lfY025970@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: crees (ports committer)
Date: Thu May  2 21:09:47 2013
New Revision: 250194
URL: http://svnweb.freebsd.org/changeset/base/250194

Log:
  Make less fragile-- don't break if there are spaces in function definitions
  
  Return the correct line number if giving an error in a function

Modified:
  user/crees/rclint/rclint.py

Modified: user/crees/rclint/rclint.py
==============================================================================
--- user/crees/rclint/rclint.py	Thu May  2 20:00:11 2013	(r250193)
+++ user/crees/rclint/rclint.py	Thu May  2 21:09:47 2013	(r250194)
@@ -28,7 +28,7 @@ __version__ = '$FreeBSD$'
 
 MAJOR = 0
 MINOR = 0
-MICRO = 5
+MICRO = 6
 
 DATADIR = '.'
 
@@ -227,9 +227,11 @@ class Function:
             error.give('functions_inline_brace', num)
         elif lines[1] and lines[1][0] == '{':
             try:
-                self.name = re.match(r'([\S_]+)\(\)$', lines[0]).group(1)
+                self.name = re.match(r'([\S_]+\s*)\(\)$', lines[0]).group(1)
             except:
                 error.give('functions_problem', num)
+            if ' ' in self.name:
+                error.give('functions_problem', num)
             self.length = 0
             self.line = num
             self.value = []
@@ -428,9 +430,11 @@ def do_rclint(filename):
     for function in lineobj['Function']:
         if function.short():
             error.give('functions_short', function.line)
+        counter = 0
         for l in function.value:
+            counter += 1
             if 'chown' in l:
-                error.warn('functions_chown', function.line)
+                error.warn('functions_chown', function.line + counter)
 
     logging.debug('Checking for run_rc_command')
     for s in lineobj['Statement']:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305022109.r42L9lfY025970>