From 8ecec4cabf3da6340b9c547926a1659936a12f8d Mon Sep 17 00:00:00 2001 From: Bhushan Srivastava <59949692+he11owthere@users.noreply.github.com> Date: Sat, 2 Dec 2023 00:30:50 +0530 Subject: [PATCH] Update docs_formatter.py --- ivy_lint/formatters/docs_formatter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ivy_lint/formatters/docs_formatter.py b/ivy_lint/formatters/docs_formatter.py index e9a8a36..e8c70f8 100644 --- a/ivy_lint/formatters/docs_formatter.py +++ b/ivy_lint/formatters/docs_formatter.py @@ -9,8 +9,6 @@ class DocstringFormatter(BaseDocstringFormatter): def validate_section_name(self, section_name, VALID_SECTION_NAMES): if section_name not in VALID_SECTION_NAMES: raise ValueError(f"Invalid section name: {section_name}. Valid section names are {VALID_SECTION_NAMES}") - return False - return True def format_docstring(self, doc): """Formats a single docstring.""" @@ -40,7 +38,9 @@ def format_docstring(self, doc): if stripped_line.startswith('-') and stripped_line.endswith('-'): section_title = prev_line - if not self.validate_section_name(section_title, VALID_SECTION_NAMES): + try: + self.validate_section_name(section_title, VALID_SECTION_NAMES) + except ValueError as e: incorrect_sections.add(idx) if not is_codeblock and stripped_line.startswith('>>>'):