svn commit: r250194 - user/crees/rclint
Chris Rees
crees at FreeBSD.org
Thu May 2 21:09:47 UTC 2013
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']:
More information about the svn-src-user
mailing list