[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/quotes/

2018-03-29 Thread Brian Dolbec
commit: 4d375cd6318dd5cc16853c931acf33e3e92a794c
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:04:31 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Fri Mar 30 00:43:45 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=4d375cd6

repoman: New linechecks module, quotes

 .../repoman/modules/linechecks/quotes/__init__.py  | 27 +++
 .../repoman/modules/linechecks/quotes/quoteda.py   | 16 
 .../repoman/modules/linechecks/quotes/quotes.py| 86 ++
 3 files changed, 129 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/__init__.py 
b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
new file mode 100644
index 0..6043ab20c
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
@@ -0,0 +1,27 @@
+# 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':{
+   'quote-check': {
+   'name': "quote",
+   'sourcefile': "quotes",
+   'class': "EbuildQuote",
+   'description': doc,
+   },
+   'quoteda-check': {
+   'name': "quoteda",
+   'sourcefile': "quoteda",
+   'class': "EbuildQuotedA",
+   'description': doc,
+   },
+   }
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
new file mode 100644
index 0..7fd9ba797
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
@@ -0,0 +1,16 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuotedA(LineCheck):
+   """Ensure ebuilds have no quoting around ${A}"""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   a_quoted = re.compile(r'.*\"\$(\{A\}|A)\"')
+
+   def check(self, num, line):
+   match = self.a_quoted.match(line)
+   if match:
+   return "Quoted \"${A}\" on line: %d"

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quotes.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
new file mode 100644
index 0..68c594e23
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
@@ -0,0 +1,86 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuote(LineCheck):
+   """Ensure ebuilds have valid quoting around things like D,FILESDIR, 
etc..."""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   _message_commands = [
+   "die", "echo", "eerror", "einfo", "elog", "eqawarn", "ewarn"]
+   _message_re = re.compile(
+   r'\s(' + "|".join(_message_commands) + r')\s+"[^"]*"\s*$')
+   _ignored_commands = ["local", "export"] + _message_commands
+   ignore_line = re.compile(
+   r'(^$)|(^\s*#.*)|(^\s*\w+=.*)' +
+   r'|(^\s*(' + "|".join(_ignored_commands) + r')\s+)')
+   ignore_comment = False
+   var_names = ["D", "DISTDIR", "FILESDIR", "S", "T", "ROOT", "WORKDIR"]
+
+   # EAPI=3/Prefix vars
+   var_names += ["ED", "EPREFIX", "EROOT"]
+
+   # variables for games.eclass
+   var_names += [
+   "Ddir", "GAMES_PREFIX_OPT", "GAMES_DATADIR",
+   "GAMES_DATADIR_BASE", "GAMES_SYSCONFDIR", "GAMES_STATEDIR",
+   "GAMES_LOGDIR", "GAMES_BINDIR"]
+
+   # variables for multibuild.eclass
+   var_names += ["BUILD_DIR"]
+
+   var_names = "(%s)" % "|".join(var_names)
+   var_reference = re.compile(
+   r'\$(\{%s\}|%s\W)' % (var_names, var_names))
+   missing_quotes = re.compile(
+   r'(\s|^)[^"\'\s]*\$\{?%s\}?[^"\'\s]*(\s|$)' % var_names)
+   cond_begin = re.compile(r'(^|\s+)\[\[($|\\$|\s+)')
+   cond_end = re.compile(r'(^|\s+)\]\]($|\\$|\s+)')
+
+   def check(self, num, line):
+   if self.var_reference.search(line) is None:
+   return
+   # There can be multiple matches / violations on a single line. 
We
+   # have to make sure none of the matches are violators. Once 
we've
+   # found one violator, any remaining matches on the same line can
+   # be ignored.
+   pos = 0
+   while pos <= len(line) - 1:
+   missing_quotes = self.missing_quotes.search(line, pos)
+   if not missing_quotes:
+   break
+   # If the last character of the previous match is a 
whitespace
+   # character, that character may be 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/quotes/

2018-03-29 Thread Brian Dolbec
commit: 0e5a3c428e629d9784ad147ecc0dddea1acad96d
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:04:31 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Thu Mar 29 20:43:39 2018 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=0e5a3c42

repoman: New linechecks module, quotes

 .../repoman/modules/linechecks/quotes/__init__.py  | 27 +++
 .../repoman/modules/linechecks/quotes/quoteda.py   | 16 
 .../repoman/modules/linechecks/quotes/quotes.py| 86 ++
 3 files changed, 129 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/__init__.py 
b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
new file mode 100644
index 0..6043ab20c
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
@@ -0,0 +1,27 @@
+# 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':{
+   'quote-check': {
+   'name': "quote",
+   'sourcefile': "quotes",
+   'class': "EbuildQuote",
+   'description': doc,
+   },
+   'quoteda-check': {
+   'name': "quoteda",
+   'sourcefile': "quoteda",
+   'class': "EbuildQuotedA",
+   'description': doc,
+   },
+   }
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
new file mode 100644
index 0..7fd9ba797
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
@@ -0,0 +1,16 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuotedA(LineCheck):
+   """Ensure ebuilds have no quoting around ${A}"""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   a_quoted = re.compile(r'.*\"\$(\{A\}|A)\"')
+
+   def check(self, num, line):
+   match = self.a_quoted.match(line)
+   if match:
+   return "Quoted \"${A}\" on line: %d"

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quotes.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
new file mode 100644
index 0..68c594e23
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
@@ -0,0 +1,86 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuote(LineCheck):
+   """Ensure ebuilds have valid quoting around things like D,FILESDIR, 
etc..."""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   _message_commands = [
+   "die", "echo", "eerror", "einfo", "elog", "eqawarn", "ewarn"]
+   _message_re = re.compile(
+   r'\s(' + "|".join(_message_commands) + r')\s+"[^"]*"\s*$')
+   _ignored_commands = ["local", "export"] + _message_commands
+   ignore_line = re.compile(
+   r'(^$)|(^\s*#.*)|(^\s*\w+=.*)' +
+   r'|(^\s*(' + "|".join(_ignored_commands) + r')\s+)')
+   ignore_comment = False
+   var_names = ["D", "DISTDIR", "FILESDIR", "S", "T", "ROOT", "WORKDIR"]
+
+   # EAPI=3/Prefix vars
+   var_names += ["ED", "EPREFIX", "EROOT"]
+
+   # variables for games.eclass
+   var_names += [
+   "Ddir", "GAMES_PREFIX_OPT", "GAMES_DATADIR",
+   "GAMES_DATADIR_BASE", "GAMES_SYSCONFDIR", "GAMES_STATEDIR",
+   "GAMES_LOGDIR", "GAMES_BINDIR"]
+
+   # variables for multibuild.eclass
+   var_names += ["BUILD_DIR"]
+
+   var_names = "(%s)" % "|".join(var_names)
+   var_reference = re.compile(
+   r'\$(\{%s\}|%s\W)' % (var_names, var_names))
+   missing_quotes = re.compile(
+   r'(\s|^)[^"\'\s]*\$\{?%s\}?[^"\'\s]*(\s|$)' % var_names)
+   cond_begin = re.compile(r'(^|\s+)\[\[($|\\$|\s+)')
+   cond_end = re.compile(r'(^|\s+)\]\]($|\\$|\s+)')
+
+   def check(self, num, line):
+   if self.var_reference.search(line) is None:
+   return
+   # There can be multiple matches / violations on a single line. 
We
+   # have to make sure none of the matches are violators. Once 
we've
+   # found one violator, any remaining matches on the same line can
+   # be ignored.
+   pos = 0
+   while pos <= len(line) - 1:
+   missing_quotes = self.missing_quotes.search(line, pos)
+   if not missing_quotes:
+   break
+   # If the last character of the previous match is a 
whitespace
+   # character, that character may be 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/quotes/

2017-12-05 Thread Brian Dolbec
commit: 7eed84f7c4c01b85583681c6d2c895739f6f41af
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:04:31 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Dec  6 00:13:27 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=7eed84f7

repoman: New linechecks module, quotes

 .../repoman/modules/linechecks/quotes/__init__.py  | 27 +++
 .../repoman/modules/linechecks/quotes/quoteda.py   | 16 
 .../repoman/modules/linechecks/quotes/quotes.py| 86 ++
 3 files changed, 129 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/__init__.py 
b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
new file mode 100644
index 0..6043ab20c
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
@@ -0,0 +1,27 @@
+# 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':{
+   'quote-check': {
+   'name': "quote",
+   'sourcefile': "quotes",
+   'class': "EbuildQuote",
+   'description': doc,
+   },
+   'quoteda-check': {
+   'name': "quoteda",
+   'sourcefile': "quoteda",
+   'class': "EbuildQuotedA",
+   'description': doc,
+   },
+   }
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
new file mode 100644
index 0..7fd9ba797
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
@@ -0,0 +1,16 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuotedA(LineCheck):
+   """Ensure ebuilds have no quoting around ${A}"""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   a_quoted = re.compile(r'.*\"\$(\{A\}|A)\"')
+
+   def check(self, num, line):
+   match = self.a_quoted.match(line)
+   if match:
+   return "Quoted \"${A}\" on line: %d"

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quotes.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
new file mode 100644
index 0..68c594e23
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
@@ -0,0 +1,86 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuote(LineCheck):
+   """Ensure ebuilds have valid quoting around things like D,FILESDIR, 
etc..."""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   _message_commands = [
+   "die", "echo", "eerror", "einfo", "elog", "eqawarn", "ewarn"]
+   _message_re = re.compile(
+   r'\s(' + "|".join(_message_commands) + r')\s+"[^"]*"\s*$')
+   _ignored_commands = ["local", "export"] + _message_commands
+   ignore_line = re.compile(
+   r'(^$)|(^\s*#.*)|(^\s*\w+=.*)' +
+   r'|(^\s*(' + "|".join(_ignored_commands) + r')\s+)')
+   ignore_comment = False
+   var_names = ["D", "DISTDIR", "FILESDIR", "S", "T", "ROOT", "WORKDIR"]
+
+   # EAPI=3/Prefix vars
+   var_names += ["ED", "EPREFIX", "EROOT"]
+
+   # variables for games.eclass
+   var_names += [
+   "Ddir", "GAMES_PREFIX_OPT", "GAMES_DATADIR",
+   "GAMES_DATADIR_BASE", "GAMES_SYSCONFDIR", "GAMES_STATEDIR",
+   "GAMES_LOGDIR", "GAMES_BINDIR"]
+
+   # variables for multibuild.eclass
+   var_names += ["BUILD_DIR"]
+
+   var_names = "(%s)" % "|".join(var_names)
+   var_reference = re.compile(
+   r'\$(\{%s\}|%s\W)' % (var_names, var_names))
+   missing_quotes = re.compile(
+   r'(\s|^)[^"\'\s]*\$\{?%s\}?[^"\'\s]*(\s|$)' % var_names)
+   cond_begin = re.compile(r'(^|\s+)\[\[($|\\$|\s+)')
+   cond_end = re.compile(r'(^|\s+)\]\]($|\\$|\s+)')
+
+   def check(self, num, line):
+   if self.var_reference.search(line) is None:
+   return
+   # There can be multiple matches / violations on a single line. 
We
+   # have to make sure none of the matches are violators. Once 
we've
+   # found one violator, any remaining matches on the same line can
+   # be ignored.
+   pos = 0
+   while pos <= len(line) - 1:
+   missing_quotes = self.missing_quotes.search(line, pos)
+   if not missing_quotes:
+   break
+   # If the last character of the previous match is a 
whitespace
+   # character, that character may be 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/quotes/, ...

2017-12-05 Thread Brian Dolbec
commit: 75ec4970a364fb555405c29dd60a79a18414fc9a
Author: Brian Dolbec  gentoo  org>
AuthorDate: Wed Aug 16 23:24:24 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Wed Dec  6 00:13:28 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=75ec4970

repoman: Initial adding file/module/API version

 repoman/pym/repoman/config.py| 7 +--
 repoman/pym/repoman/main.py  | 3 +++
 repoman/pym/repoman/modules/linechecks/assignment/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/config.py | 2 +-
 repoman/pym/repoman/modules/linechecks/depend/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/deprecated/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/do/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/eapi/__init__.py  | 3 ++-
 repoman/pym/repoman/modules/linechecks/emake/__init__.py | 3 ++-
 repoman/pym/repoman/modules/linechecks/gentoo_header/__init__.py | 3 ++-
 repoman/pym/repoman/modules/linechecks/helpers/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/nested/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/patches/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/phases/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/portage/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/quotes/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/uri/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/use/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/useless/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/linechecks/whitespace/__init__.py| 3 ++-
 repoman/pym/repoman/modules/linechecks/workaround/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/depend/__init__.py  | 3 ++-
 repoman/pym/repoman/modules/scan/directories/__init__.py | 3 ++-
 repoman/pym/repoman/modules/scan/eapi/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/ebuild/__init__.py  | 3 ++-
 repoman/pym/repoman/modules/scan/eclasses/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/fetch/__init__.py   | 3 ++-
 repoman/pym/repoman/modules/scan/keywords/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/manifest/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/metadata/__init__.py| 3 ++-
 repoman/pym/repoman/modules/scan/module.py   | 9 ++---
 repoman/pym/repoman/modules/scan/options/__init__.py | 3 ++-
 repoman/pym/repoman/qa_data.py   | 4 ++--
 repoman/pym/repoman/repos.py | 2 +-
 repoman/pym/repoman/scanner.py   | 3 ++-
 35 files changed, 76 insertions(+), 38 deletions(-)

diff --git a/repoman/pym/repoman/config.py b/repoman/pym/repoman/config.py
index 3329f0e7e..6facf5cc8 100644
--- a/repoman/pym/repoman/config.py
+++ b/repoman/pym/repoman/config.py
@@ -144,8 +144,11 @@ def load_config(conf_dirs, file_extensions=None, 
valid_versions=None):
 
if config:
if config['version'] not in valid_versions:
-   raise ConfigError("Invalid file version: %s in: 
%s\nPlease upgrade repoman: current valid versions: %s"
-   % (config['version'], filename, 
valid_versions))
+   raise ConfigError(
+   "Invalid file version: %s in: 
%s\nPlease upgrade to "
+   ">=app-portage/repoman-%s, current 
valid API versions: %s"
+   % (config['version'], filename,
+   config['repoman_version'], 
valid_versions))
result = merge_config(result, config)
 
return result

diff --git a/repoman/pym/repoman/main.py b/repoman/pym/repoman/main.py
index c1e3b99fe..81e2ff61e 100755
--- a/repoman/pym/repoman/main.py
+++ b/repoman/pym/repoman/main.py
@@ -47,10 +47,12 @@ os.umask(0o22)
 LOGLEVEL = logging.WARNING
 portage.util.initialize_logger(LOGLEVEL)
 
+VALID_VERSIONS = [1,]
 
 def repoman_main(argv):
config_root = os.environ.get("PORTAGE_CONFIGROOT")
repoman_settings = portage.config(config_root=config_root, 
local_config=False)
+   repoman_settings.valid_versions = VALID_VERSIONS
 
if repoman_settings.get("NOCOLOR", "").lower() in ("yes", "true") or \
repoman_settings.get('TERM') == 'dumb' or \
@@ -92,6 +94,7 @@ def repoman_main(argv):
config_root, portdir, portdir_overlay,
repoman_settings, vcs_settings, options, qadata)
repoman_settings = repo_settings.repoman_settings
+   

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/quotes/

2017-12-05 Thread Brian Dolbec
commit: 3912a7c5b5852bb5011e677e536f9fe9e5440bd6
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:04:31 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Tue Dec  5 18:24:49 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=3912a7c5

repoman: New linechecks module, quotes

 .../repoman/modules/linechecks/quotes/__init__.py  | 27 +++
 .../repoman/modules/linechecks/quotes/quoteda.py   | 16 
 .../repoman/modules/linechecks/quotes/quotes.py| 86 ++
 3 files changed, 129 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/__init__.py 
b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
new file mode 100644
index 0..6043ab20c
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
@@ -0,0 +1,27 @@
+# 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':{
+   'quote-check': {
+   'name': "quote",
+   'sourcefile': "quotes",
+   'class': "EbuildQuote",
+   'description': doc,
+   },
+   'quoteda-check': {
+   'name': "quoteda",
+   'sourcefile': "quoteda",
+   'class': "EbuildQuotedA",
+   'description': doc,
+   },
+   }
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
new file mode 100644
index 0..7fd9ba797
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
@@ -0,0 +1,16 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuotedA(LineCheck):
+   """Ensure ebuilds have no quoting around ${A}"""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   a_quoted = re.compile(r'.*\"\$(\{A\}|A)\"')
+
+   def check(self, num, line):
+   match = self.a_quoted.match(line)
+   if match:
+   return "Quoted \"${A}\" on line: %d"

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quotes.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
new file mode 100644
index 0..68c594e23
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
@@ -0,0 +1,86 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuote(LineCheck):
+   """Ensure ebuilds have valid quoting around things like D,FILESDIR, 
etc..."""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   _message_commands = [
+   "die", "echo", "eerror", "einfo", "elog", "eqawarn", "ewarn"]
+   _message_re = re.compile(
+   r'\s(' + "|".join(_message_commands) + r')\s+"[^"]*"\s*$')
+   _ignored_commands = ["local", "export"] + _message_commands
+   ignore_line = re.compile(
+   r'(^$)|(^\s*#.*)|(^\s*\w+=.*)' +
+   r'|(^\s*(' + "|".join(_ignored_commands) + r')\s+)')
+   ignore_comment = False
+   var_names = ["D", "DISTDIR", "FILESDIR", "S", "T", "ROOT", "WORKDIR"]
+
+   # EAPI=3/Prefix vars
+   var_names += ["ED", "EPREFIX", "EROOT"]
+
+   # variables for games.eclass
+   var_names += [
+   "Ddir", "GAMES_PREFIX_OPT", "GAMES_DATADIR",
+   "GAMES_DATADIR_BASE", "GAMES_SYSCONFDIR", "GAMES_STATEDIR",
+   "GAMES_LOGDIR", "GAMES_BINDIR"]
+
+   # variables for multibuild.eclass
+   var_names += ["BUILD_DIR"]
+
+   var_names = "(%s)" % "|".join(var_names)
+   var_reference = re.compile(
+   r'\$(\{%s\}|%s\W)' % (var_names, var_names))
+   missing_quotes = re.compile(
+   r'(\s|^)[^"\'\s]*\$\{?%s\}?[^"\'\s]*(\s|$)' % var_names)
+   cond_begin = re.compile(r'(^|\s+)\[\[($|\\$|\s+)')
+   cond_end = re.compile(r'(^|\s+)\]\]($|\\$|\s+)')
+
+   def check(self, num, line):
+   if self.var_reference.search(line) is None:
+   return
+   # There can be multiple matches / violations on a single line. 
We
+   # have to make sure none of the matches are violators. Once 
we've
+   # found one violator, any remaining matches on the same line can
+   # be ignored.
+   pos = 0
+   while pos <= len(line) - 1:
+   missing_quotes = self.missing_quotes.search(line, pos)
+   if not missing_quotes:
+   break
+   # If the last character of the previous match is a 
whitespace
+   # character, that character may be 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/quotes/

2017-11-26 Thread Brian Dolbec
commit: 93847cf38f2e31d48809eaef7ad63fe6c565bec7
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:04:31 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sun Nov 26 17:32:19 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=93847cf3

repoman: New linechecks module, quotes

 .../repoman/modules/linechecks/quotes/__init__.py  | 27 +++
 .../repoman/modules/linechecks/quotes/quoteda.py   | 16 
 .../repoman/modules/linechecks/quotes/quotes.py| 86 ++
 3 files changed, 129 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/__init__.py 
b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
new file mode 100644
index 0..6043ab20c
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
@@ -0,0 +1,27 @@
+# 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':{
+   'quote-check': {
+   'name': "quote",
+   'sourcefile': "quotes",
+   'class': "EbuildQuote",
+   'description': doc,
+   },
+   'quoteda-check': {
+   'name': "quoteda",
+   'sourcefile': "quoteda",
+   'class': "EbuildQuotedA",
+   'description': doc,
+   },
+   }
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
new file mode 100644
index 0..7fd9ba797
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
@@ -0,0 +1,16 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuotedA(LineCheck):
+   """Ensure ebuilds have no quoting around ${A}"""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   a_quoted = re.compile(r'.*\"\$(\{A\}|A)\"')
+
+   def check(self, num, line):
+   match = self.a_quoted.match(line)
+   if match:
+   return "Quoted \"${A}\" on line: %d"

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quotes.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
new file mode 100644
index 0..68c594e23
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
@@ -0,0 +1,86 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuote(LineCheck):
+   """Ensure ebuilds have valid quoting around things like D,FILESDIR, 
etc..."""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   _message_commands = [
+   "die", "echo", "eerror", "einfo", "elog", "eqawarn", "ewarn"]
+   _message_re = re.compile(
+   r'\s(' + "|".join(_message_commands) + r')\s+"[^"]*"\s*$')
+   _ignored_commands = ["local", "export"] + _message_commands
+   ignore_line = re.compile(
+   r'(^$)|(^\s*#.*)|(^\s*\w+=.*)' +
+   r'|(^\s*(' + "|".join(_ignored_commands) + r')\s+)')
+   ignore_comment = False
+   var_names = ["D", "DISTDIR", "FILESDIR", "S", "T", "ROOT", "WORKDIR"]
+
+   # EAPI=3/Prefix vars
+   var_names += ["ED", "EPREFIX", "EROOT"]
+
+   # variables for games.eclass
+   var_names += [
+   "Ddir", "GAMES_PREFIX_OPT", "GAMES_DATADIR",
+   "GAMES_DATADIR_BASE", "GAMES_SYSCONFDIR", "GAMES_STATEDIR",
+   "GAMES_LOGDIR", "GAMES_BINDIR"]
+
+   # variables for multibuild.eclass
+   var_names += ["BUILD_DIR"]
+
+   var_names = "(%s)" % "|".join(var_names)
+   var_reference = re.compile(
+   r'\$(\{%s\}|%s\W)' % (var_names, var_names))
+   missing_quotes = re.compile(
+   r'(\s|^)[^"\'\s]*\$\{?%s\}?[^"\'\s]*(\s|$)' % var_names)
+   cond_begin = re.compile(r'(^|\s+)\[\[($|\\$|\s+)')
+   cond_end = re.compile(r'(^|\s+)\]\]($|\\$|\s+)')
+
+   def check(self, num, line):
+   if self.var_reference.search(line) is None:
+   return
+   # There can be multiple matches / violations on a single line. 
We
+   # have to make sure none of the matches are violators. Once 
we've
+   # found one violator, any remaining matches on the same line can
+   # be ignored.
+   pos = 0
+   while pos <= len(line) - 1:
+   missing_quotes = self.missing_quotes.search(line, pos)
+   if not missing_quotes:
+   break
+   # If the last character of the previous match is a 
whitespace
+   # character, that character may be 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/quotes/

2017-09-11 Thread Brian Dolbec
commit: 2f8ec909aac9fffc14c15499ed3394bd6445621c
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:04:31 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Mon Sep 11 16:13:15 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=2f8ec909

repoman: New linechecks module, quotes

 .../repoman/modules/linechecks/quotes/__init__.py  | 27 +++
 .../repoman/modules/linechecks/quotes/quoteda.py   | 16 
 .../repoman/modules/linechecks/quotes/quotes.py| 86 ++
 3 files changed, 129 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/__init__.py 
b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
new file mode 100644
index 0..6043ab20c
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
@@ -0,0 +1,27 @@
+# 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':{
+   'quote-check': {
+   'name': "quote",
+   'sourcefile': "quotes",
+   'class': "EbuildQuote",
+   'description': doc,
+   },
+   'quoteda-check': {
+   'name': "quoteda",
+   'sourcefile': "quoteda",
+   'class': "EbuildQuotedA",
+   'description': doc,
+   },
+   }
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
new file mode 100644
index 0..7fd9ba797
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
@@ -0,0 +1,16 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuotedA(LineCheck):
+   """Ensure ebuilds have no quoting around ${A}"""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   a_quoted = re.compile(r'.*\"\$(\{A\}|A)\"')
+
+   def check(self, num, line):
+   match = self.a_quoted.match(line)
+   if match:
+   return "Quoted \"${A}\" on line: %d"

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quotes.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
new file mode 100644
index 0..68c594e23
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
@@ -0,0 +1,86 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuote(LineCheck):
+   """Ensure ebuilds have valid quoting around things like D,FILESDIR, 
etc..."""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   _message_commands = [
+   "die", "echo", "eerror", "einfo", "elog", "eqawarn", "ewarn"]
+   _message_re = re.compile(
+   r'\s(' + "|".join(_message_commands) + r')\s+"[^"]*"\s*$')
+   _ignored_commands = ["local", "export"] + _message_commands
+   ignore_line = re.compile(
+   r'(^$)|(^\s*#.*)|(^\s*\w+=.*)' +
+   r'|(^\s*(' + "|".join(_ignored_commands) + r')\s+)')
+   ignore_comment = False
+   var_names = ["D", "DISTDIR", "FILESDIR", "S", "T", "ROOT", "WORKDIR"]
+
+   # EAPI=3/Prefix vars
+   var_names += ["ED", "EPREFIX", "EROOT"]
+
+   # variables for games.eclass
+   var_names += [
+   "Ddir", "GAMES_PREFIX_OPT", "GAMES_DATADIR",
+   "GAMES_DATADIR_BASE", "GAMES_SYSCONFDIR", "GAMES_STATEDIR",
+   "GAMES_LOGDIR", "GAMES_BINDIR"]
+
+   # variables for multibuild.eclass
+   var_names += ["BUILD_DIR"]
+
+   var_names = "(%s)" % "|".join(var_names)
+   var_reference = re.compile(
+   r'\$(\{%s\}|%s\W)' % (var_names, var_names))
+   missing_quotes = re.compile(
+   r'(\s|^)[^"\'\s]*\$\{?%s\}?[^"\'\s]*(\s|$)' % var_names)
+   cond_begin = re.compile(r'(^|\s+)\[\[($|\\$|\s+)')
+   cond_end = re.compile(r'(^|\s+)\]\]($|\\$|\s+)')
+
+   def check(self, num, line):
+   if self.var_reference.search(line) is None:
+   return
+   # There can be multiple matches / violations on a single line. 
We
+   # have to make sure none of the matches are violators. Once 
we've
+   # found one violator, any remaining matches on the same line can
+   # be ignored.
+   pos = 0
+   while pos <= len(line) - 1:
+   missing_quotes = self.missing_quotes.search(line, pos)
+   if not missing_quotes:
+   break
+   # If the last character of the previous match is a 
whitespace
+   # character, that character may be 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/quotes/

2017-07-14 Thread Brian Dolbec
commit: 7802d8ede8fe099334e62ad5f1be776d184ae9e8
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:04:31 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sat Jul 15 02:25:45 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=7802d8ed

repoman: New linechecks module, quotes

 .../repoman/modules/linechecks/quotes/__init__.py  | 27 +++
 .../repoman/modules/linechecks/quotes/quoteda.py   | 16 
 .../repoman/modules/linechecks/quotes/quotes.py| 86 ++
 3 files changed, 129 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/__init__.py 
b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
new file mode 100644
index 0..6043ab20c
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
@@ -0,0 +1,27 @@
+# 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':{
+   'quote-check': {
+   'name': "quote",
+   'sourcefile': "quotes",
+   'class': "EbuildQuote",
+   'description': doc,
+   },
+   'quoteda-check': {
+   'name': "quoteda",
+   'sourcefile': "quoteda",
+   'class': "EbuildQuotedA",
+   'description': doc,
+   },
+   }
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
new file mode 100644
index 0..7fd9ba797
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
@@ -0,0 +1,16 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuotedA(LineCheck):
+   """Ensure ebuilds have no quoting around ${A}"""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   a_quoted = re.compile(r'.*\"\$(\{A\}|A)\"')
+
+   def check(self, num, line):
+   match = self.a_quoted.match(line)
+   if match:
+   return "Quoted \"${A}\" on line: %d"

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quotes.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
new file mode 100644
index 0..68c594e23
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
@@ -0,0 +1,86 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuote(LineCheck):
+   """Ensure ebuilds have valid quoting around things like D,FILESDIR, 
etc..."""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   _message_commands = [
+   "die", "echo", "eerror", "einfo", "elog", "eqawarn", "ewarn"]
+   _message_re = re.compile(
+   r'\s(' + "|".join(_message_commands) + r')\s+"[^"]*"\s*$')
+   _ignored_commands = ["local", "export"] + _message_commands
+   ignore_line = re.compile(
+   r'(^$)|(^\s*#.*)|(^\s*\w+=.*)' +
+   r'|(^\s*(' + "|".join(_ignored_commands) + r')\s+)')
+   ignore_comment = False
+   var_names = ["D", "DISTDIR", "FILESDIR", "S", "T", "ROOT", "WORKDIR"]
+
+   # EAPI=3/Prefix vars
+   var_names += ["ED", "EPREFIX", "EROOT"]
+
+   # variables for games.eclass
+   var_names += [
+   "Ddir", "GAMES_PREFIX_OPT", "GAMES_DATADIR",
+   "GAMES_DATADIR_BASE", "GAMES_SYSCONFDIR", "GAMES_STATEDIR",
+   "GAMES_LOGDIR", "GAMES_BINDIR"]
+
+   # variables for multibuild.eclass
+   var_names += ["BUILD_DIR"]
+
+   var_names = "(%s)" % "|".join(var_names)
+   var_reference = re.compile(
+   r'\$(\{%s\}|%s\W)' % (var_names, var_names))
+   missing_quotes = re.compile(
+   r'(\s|^)[^"\'\s]*\$\{?%s\}?[^"\'\s]*(\s|$)' % var_names)
+   cond_begin = re.compile(r'(^|\s+)\[\[($|\\$|\s+)')
+   cond_end = re.compile(r'(^|\s+)\]\]($|\\$|\s+)')
+
+   def check(self, num, line):
+   if self.var_reference.search(line) is None:
+   return
+   # There can be multiple matches / violations on a single line. 
We
+   # have to make sure none of the matches are violators. Once 
we've
+   # found one violator, any remaining matches on the same line can
+   # be ignored.
+   pos = 0
+   while pos <= len(line) - 1:
+   missing_quotes = self.missing_quotes.search(line, pos)
+   if not missing_quotes:
+   break
+   # If the last character of the previous match is a 
whitespace
+   # character, that character may be 

[gentoo-commits] proj/portage:repoman commit in: repoman/pym/repoman/modules/linechecks/quotes/

2017-07-14 Thread Brian Dolbec
commit: 8ce89cc3bd32e5f8b8b03464e109f2c484c73a10
Author: Brian Dolbec  gentoo  org>
AuthorDate: Sat Jul 15 01:04:31 2017 +
Commit: Brian Dolbec  gentoo  org>
CommitDate: Sat Jul 15 02:08:28 2017 +
URL:https://gitweb.gentoo.org/proj/portage.git/commit/?id=8ce89cc3

repoman: New linechecks module, quotes

 .../repoman/modules/linechecks/quotes/__init__.py  | 27 +++
 .../repoman/modules/linechecks/quotes/quoteda.py   | 16 
 .../repoman/modules/linechecks/quotes/quotes.py| 86 ++
 3 files changed, 129 insertions(+)

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/__init__.py 
b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
new file mode 100644
index 0..6043ab20c
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/__init__.py
@@ -0,0 +1,27 @@
+# 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':{
+   'quote-check': {
+   'name': "quote",
+   'sourcefile': "quotes",
+   'class': "EbuildQuote",
+   'description': doc,
+   },
+   'quoteda-check': {
+   'name': "quoteda",
+   'sourcefile': "quoteda",
+   'class': "EbuildQuotedA",
+   'description': doc,
+   },
+   }
+}
+

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
new file mode 100644
index 0..7fd9ba797
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quoteda.py
@@ -0,0 +1,16 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuotedA(LineCheck):
+   """Ensure ebuilds have no quoting around ${A}"""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   a_quoted = re.compile(r'.*\"\$(\{A\}|A)\"')
+
+   def check(self, num, line):
+   match = self.a_quoted.match(line)
+   if match:
+   return "Quoted \"${A}\" on line: %d"

diff --git a/repoman/pym/repoman/modules/linechecks/quotes/quotes.py 
b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
new file mode 100644
index 0..68c594e23
--- /dev/null
+++ b/repoman/pym/repoman/modules/linechecks/quotes/quotes.py
@@ -0,0 +1,86 @@
+
+import re
+
+from repoman.modules.linechecks.base import LineCheck
+
+
+class EbuildQuote(LineCheck):
+   """Ensure ebuilds have valid quoting around things like D,FILESDIR, 
etc..."""
+
+   repoman_check_name = 'ebuild.minorsyn'
+   _message_commands = [
+   "die", "echo", "eerror", "einfo", "elog", "eqawarn", "ewarn"]
+   _message_re = re.compile(
+   r'\s(' + "|".join(_message_commands) + r')\s+"[^"]*"\s*$')
+   _ignored_commands = ["local", "export"] + _message_commands
+   ignore_line = re.compile(
+   r'(^$)|(^\s*#.*)|(^\s*\w+=.*)' +
+   r'|(^\s*(' + "|".join(_ignored_commands) + r')\s+)')
+   ignore_comment = False
+   var_names = ["D", "DISTDIR", "FILESDIR", "S", "T", "ROOT", "WORKDIR"]
+
+   # EAPI=3/Prefix vars
+   var_names += ["ED", "EPREFIX", "EROOT"]
+
+   # variables for games.eclass
+   var_names += [
+   "Ddir", "GAMES_PREFIX_OPT", "GAMES_DATADIR",
+   "GAMES_DATADIR_BASE", "GAMES_SYSCONFDIR", "GAMES_STATEDIR",
+   "GAMES_LOGDIR", "GAMES_BINDIR"]
+
+   # variables for multibuild.eclass
+   var_names += ["BUILD_DIR"]
+
+   var_names = "(%s)" % "|".join(var_names)
+   var_reference = re.compile(
+   r'\$(\{%s\}|%s\W)' % (var_names, var_names))
+   missing_quotes = re.compile(
+   r'(\s|^)[^"\'\s]*\$\{?%s\}?[^"\'\s]*(\s|$)' % var_names)
+   cond_begin = re.compile(r'(^|\s+)\[\[($|\\$|\s+)')
+   cond_end = re.compile(r'(^|\s+)\]\]($|\\$|\s+)')
+
+   def check(self, num, line):
+   if self.var_reference.search(line) is None:
+   return
+   # There can be multiple matches / violations on a single line. 
We
+   # have to make sure none of the matches are violators. Once 
we've
+   # found one violator, any remaining matches on the same line can
+   # be ignored.
+   pos = 0
+   while pos <= len(line) - 1:
+   missing_quotes = self.missing_quotes.search(line, pos)
+   if not missing_quotes:
+   break
+   # If the last character of the previous match is a 
whitespace
+   # character, that character may be