Skip to content

Commit

Permalink
Update docs_formatter.py
Browse files Browse the repository at this point in the history
  • Loading branch information
he11owthere authored Dec 1, 2023
1 parent 306b148 commit 8ecec4c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ivy_lint/formatters/docs_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down Expand Up @@ -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('>>>'):
Expand Down

0 comments on commit 8ecec4c

Please sign in to comment.