diff options
Diffstat (limited to 'buildscripts/resmokelib/utils/jscomment.py')
-rw-r--r-- | buildscripts/resmokelib/utils/jscomment.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/buildscripts/resmokelib/utils/jscomment.py b/buildscripts/resmokelib/utils/jscomment.py index 43484573fac..67758197c5c 100644 --- a/buildscripts/resmokelib/utils/jscomment.py +++ b/buildscripts/resmokelib/utils/jscomment.py @@ -1,6 +1,4 @@ -""" -Utility for parsing JS comments. -""" +"""Utility for parsing JS comments.""" from __future__ import absolute_import @@ -13,9 +11,9 @@ _JSTEST_TAGS_RE = re.compile(r".*@tags\s*:\s*(\[[^\]]*\])", re.DOTALL) def get_tags(pathname): - """ - Returns the list of tags found in the (JS-style) comments of - 'pathname'. The definition can span multiple lines, use unquoted, + """Return the list of tags found in the (JS-style) comments of 'pathname'. + + The definition can span multiple lines, use unquoted, single-quoted, or double-quoted strings, and use the '#' character for inline commenting. @@ -48,9 +46,10 @@ def get_tags(pathname): return [] -def _strip_jscomments(s): - """ - Given a string 's' that represents the contents after the "@tags:" +def _strip_jscomments(string): + """Strip JS comments from a 'string'. + + Given a string 'string' that represents the contents after the "@tags:" annotation in the JS file, this function returns a string that can be converted to YAML. @@ -69,7 +68,7 @@ def _strip_jscomments(s): yaml_lines = [] - for line in s.splitlines(): + for line in string.splitlines(): # Remove leading whitespace and symbols that commonly appear in JS comments. line = line.lstrip("\t ").lstrip("*/") yaml_lines.append(line) |