From 36a3eaaa351e378f1ba48518ecf6341f66b7bc3d Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Mon, 14 Oct 2019 21:51:43 -0400 Subject: [PATCH] pep8: Permit ".)" at the end of resource docs When a sentence is wholly contained within parentheses, the period at the end should appear inside the closing parenthesis. The current pep8 check requires that e.g. resource property descriptions must end with a period, which makes things awkward when the last sentence is parenthesised. Allow them to optionally end with ".)" instead. Change-Id: I489c424136047e57e4649739fd0b0727bc3cc915 --- tools/custom_guidelines.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/custom_guidelines.py b/tools/custom_guidelines.py index ce0defc80c..3e8f4e2c79 100644 --- a/tools/custom_guidelines.py +++ b/tools/custom_guidelines.py @@ -199,7 +199,7 @@ class HeatCustomGuidelines(object): 'with uppercase letter') % error_key.title(), 'snippet': description}) self.print_guideline_error(**error_kwargs) - if not description.endswith('.'): + if not (description.endswith('.') or description.endswith('.)')): error_kwargs.update( {'message': _('%s description summary omitted ' 'terminator at the end') % error_key.title(), @@ -250,7 +250,8 @@ class HeatCustomGuidelines(object): if re.search("^(:param|:type|:returns|:rtype|:raises)", line): params = True - if not params and not doclines[-2].endswith('.'): + if not params and not (doclines[-2].endswith('.') or + doclines[-2].endswith('.)')): error_kwargs.update( {'message': _('%s description omitted ' 'terminator at the end') % error_key.title(),