diff options
author | Kyle Keen <keenerd@gmail.com> | 2017-03-12 23:08:32 -0400 |
---|---|---|
committer | Kyle Keen <keenerd@gmail.com> | 2017-03-12 23:08:32 -0400 |
commit | 5e36bd74e8369a0a2a913c8b1e9ed69c74f3b033 (patch) | |
tree | a1f159ee0643c567f8be451c61a37cb4c7399a00 | |
parent | 78327a8c7461b923b6deae921edfb436e5df73d9 (diff) | |
download | namcap-5e36bd74e8369a0a2a913c8b1e9ed69c74f3b033.tar.gz namcap-5e36bd74e8369a0a2a913c8b1e9ed69c74f3b033.zip |
Warn on use of undocumented makepkg functions (FS#43502)
Signed-off-by: Kyle Keen <keenerd@gmail.com>
-rw-r--r-- | Namcap/rules/__init__.py | 1 | ||||
-rw-r--r-- | Namcap/rules/makepkgfunctions.py | 37 | ||||
-rw-r--r-- | namcap-tags | 1 |
3 files changed, 39 insertions, 0 deletions
diff --git a/Namcap/rules/__init__.py b/Namcap/rules/__init__.py index 7d313f7..e8775a0 100644 --- a/Namcap/rules/__init__.py +++ b/Namcap/rules/__init__.py @@ -59,6 +59,7 @@ from . import ( carch, extravars, invalidstartdir, + makepkgfunctions, missingvars, pkginfo, pkgnameindesc, diff --git a/Namcap/rules/makepkgfunctions.py b/Namcap/rules/makepkgfunctions.py new file mode 100644 index 0000000..fa20f5f --- /dev/null +++ b/Namcap/rules/makepkgfunctions.py @@ -0,0 +1,37 @@ +# +# namcap rules - makepkgfunctions +# Copyright (C) 2017 Kyle Keen <keenerd@gmail.com> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +import re +from Namcap.ruleclass import * + +class package(PkgbuildRule): + name = "makepkgfunctions" + description = "Looks for calls to makepkg functionality" + def analyze(self, pkginfo, tar): + bad_calls = ['msg', 'msg2', 'warning', 'error', 'plain'] + regex = re.compile('^\s+(%s) ' % '|'.join(bad_calls)) + hits = set() + for i in pkginfo.pkgbuild: + if regex.match(i): + call = regex.match(i).group(1) + hits.add(call) + for i in hits: + self.warnings.append(("makepkg-function-used %s", i)) + +# vim: set ts=4 sw=4 noet: diff --git a/namcap-tags b/namcap-tags index f686c14..3de6c75 100644 --- a/namcap-tags +++ b/namcap-tags @@ -44,6 +44,7 @@ libtool-file-present %s :: File (%s) is a libtool file library-no-package-associated %s :: Referenced library '%s' is an uninstalled dependency link-level-dependence %s in %s :: Link-level dependence (%s) in file %s lots-of-docs %f :: Package was %.0f%% docs by size; maybe you should split out a docs package +makepkg-function-used %s :: PKGBUILD uses internal makepkg '%s' subroutine missing-backup-file %s :: File in backup array (%s) not found in package missing-description :: Missing description in PKGBUILD missing-contributor :: Missing Contributor tag |