aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <dolsen@gentoo.org>2017-07-15 01:02:24 +0000
committerZac Medico <zmedico@gentoo.org>2018-03-29 20:51:18 -0700
commit4a63297643accd75971622000f15613200501081 (patch)
treecd1bc6111dcacf6084eafe2bff6430294560b155
parentrepoman: New linechecks module, helpers (diff)
downloadportage-4a63297643accd75971622000f15613200501081.tar.gz
portage-4a63297643accd75971622000f15613200501081.tar.bz2
portage-4a63297643accd75971622000f15613200501081.zip
repoman: New linechecks module, nested
-rw-r--r--repoman/pym/repoman/modules/linechecks/nested/__init__.py21
-rw-r--r--repoman/pym/repoman/modules/linechecks/nested/nested.py15
-rw-r--r--repoman/pym/repoman/modules/linechecks/nested/nesteddie.py11
3 files changed, 47 insertions, 0 deletions
diff --git a/repoman/pym/repoman/modules/linechecks/nested/__init__.py b/repoman/pym/repoman/modules/linechecks/nested/__init__.py
new file mode 100644
index 000000000..8eeeccbac
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/nested/__init__.py
@@ -0,0 +1,21 @@
+# Copyright 2015-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+doc = """Nested plug-in module for repoman LineChecks.
+Performs nested subshell checks on ebuilds."""
+__doc__ = doc[:]
+
+
+module_spec = {
+ 'name': 'do',
+ 'description': doc,
+ 'provides':{
+ 'nesteddie-check': {
+ 'name': "nesteddie",
+ 'sourcefile': "nested",
+ 'class': "EbuildNestedDie",
+ 'description': doc,
+ },
+ }
+}
+
diff --git a/repoman/pym/repoman/modules/linechecks/nested/nested.py b/repoman/pym/repoman/modules/linechecks/nested/nested.py
new file mode 100644
index 000000000..06b272772
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/nested/nested.py
@@ -0,0 +1,15 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildNestedDie(LineCheck):
+ """Check ebuild for nested die statements (die statements in subshells)"""
+
+ repoman_check_name = 'ebuild.nesteddie'
+ nesteddie_re = re.compile(r'^[^#]*\s\(\s[^)]*\bdie\b')
+
+ def check(self, num, line):
+ if self.nesteddie_re.match(line):
+ return self.errors['NESTED_DIE_ERROR']
diff --git a/repoman/pym/repoman/modules/linechecks/nested/nesteddie.py b/repoman/pym/repoman/modules/linechecks/nested/nesteddie.py
new file mode 100644
index 000000000..6c1e4be9f
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/nested/nesteddie.py
@@ -0,0 +1,11 @@
+
+
+class EbuildNestedDie(LineCheck):
+ """Check ebuild for nested die statements (die statements in subshells)"""
+
+ repoman_check_name = 'ebuild.nesteddie'
+ nesteddie_re = re.compile(r'^[^#]*\s\(\s[^)]*\bdie\b')
+
+ def check(self, num, line):
+ if self.nesteddie_re.match(line):
+ return errors.NESTED_DIE_ERROR