From owner-svn-src-user@FreeBSD.ORG Thu May 2 21:09:47 2013 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id C8211665; Thu, 2 May 2013 21:09:47 +0000 (UTC) (envelope-from crees@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id BAAC015F5; Thu, 2 May 2013 21:09:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r42L9lff025971; Thu, 2 May 2013 21:09:47 GMT (envelope-from crees@svn.freebsd.org) Received: (from crees@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r42L9lfY025970; Thu, 2 May 2013 21:09:47 GMT (envelope-from crees@svn.freebsd.org) Message-Id: <201305022109.r42L9lfY025970@svn.freebsd.org> From: Chris Rees Date: Thu, 2 May 2013 21:09:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r250194 - user/crees/rclint X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 May 2013 21:09:47 -0000 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']: