Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Change Log

## [Unpublished] - 2025-01-12
## [0.5.18] - 2025-01-12

- Fixed
- An issue where custom exceptions such as `a.b.c.MyException.from_str`
cannot be properly parsed and compared
- A minor wording issue in DOC503 violation message
- Full diff
- https://github.com/jsh9/pydoclint/compare/0.5.17...0.5.18

## [0.5.17] - 2025-01-12

Expand Down
2 changes: 1 addition & 1 deletion pydoclint/utils/violation.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

501: 'has "raise" statements, but the docstring does not have a "Raises" section',
502: 'has a "Raises" section in the docstring, but there are not "raise" statements in the body',
503: 'exceptions in the "Raises" section in the docstring do not match those in the function body',
503: 'exceptions in the "Raises" section in the docstring do not match those in the function body.',

601: 'Class docstring contains fewer class attributes than actual class attributes.',
602: 'Class docstring contains more class attributes than in actual class attributes.',
Expand Down
2 changes: 1 addition & 1 deletion pydoclint/utils/visitor_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ def addMismatchedRaisesExceptionViolation(
body and docstring
"""
msgPostfix: str = (
f'Raises values in the docstring: {docRaises}.'
f'Raised exceptions in the docstring: {docRaises}.'
f' Raised exceptions in the body: {actualRaises}.'
)
violations.append(
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = pydoclint
version = 0.5.17
version = 0.5.18
description = A Python docstring linter that checks arguments, returns, yields, and raises sections
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down
4 changes: 2 additions & 2 deletions tests/test_baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,8 @@ def testSomeViolationsAreFixedButNewViolationsOccur(
'DOC501: Function `bad_docstring_func` has "raise" statements, but'
' the docstring does not have a "Raises" section',
'DOC503: Function `bad_docstring_func` exceptions in the "Raises"'
' section in the docstring do not match those in the function body'
' Raises values in the docstring: []. Raised'
' section in the docstring do not match those in the function body.'
' Raised exceptions in the docstring: []. Raised'
" exceptions in the body: ['ValueError'].",
]

Expand Down
18 changes: 9 additions & 9 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ def testAllowInitDocstring(style: str) -> None:
'DOC305: Class `C`: Class docstring has a "Raises" section; please put it in '
'the __init__() docstring',
'DOC503: Method `C.__init__` exceptions in the "Raises" section in the '
'docstring do not match those in the function body Raises values in the '
'docstring do not match those in the function body. Raised exceptions in the '
"docstring: ['TypeError']. Raised exceptions in the body: ['ValueError'].",
'DOC306: Class `D`: The class docstring does not need a "Yields" section, '
'because __init__() cannot yield anything',
Expand Down Expand Up @@ -808,10 +808,10 @@ def testRaises(style: str, skipRaisesCheck: bool) -> None:
'DOC501: Method `B.func1` has "raise" statements, but the docstring does not '
'have a "Raises" section',
'DOC503: Method `B.func1` exceptions in the "Raises" section in the docstring '
'do not match those in the function body Raises values in the docstring: []. '
'do not match those in the function body. Raised exceptions in the docstring: []. '
"Raised exceptions in the body: ['ValueError'].",
'DOC503: Method `B.func4` exceptions in the "Raises" section in the docstring '
'do not match those in the function body Raises values in the docstring: '
'do not match those in the function body. Raised exceptions in the docstring: '
"['CurtomError']. Raised exceptions in the body: ['CustomError'].",
'DOC502: Method `B.func5` has a "Raises" section in the docstring, but there '
'are not "raise" statements in the body',
Expand All @@ -822,22 +822,22 @@ def testRaises(style: str, skipRaisesCheck: bool) -> None:
'DOC501: Function `inner9a` has "raise" statements, but the docstring does '
'not have a "Raises" section',
'DOC503: Function `inner9a` exceptions in the "Raises" section in the '
'docstring do not match those in the function body Raises values in the '
'docstring do not match those in the function body. Raised exceptions in the '
"docstring: []. Raised exceptions in the body: ['FileNotFoundError'].",
'DOC503: Method `B.func11` exceptions in the "Raises" section in the '
'docstring do not match those in the function body Raises values in the '
'docstring do not match those in the function body. Raised exceptions in the '
"docstring: ['TypeError']. Raised exceptions in the body: ['TypeError', "
"'ValueError'].",
'DOC503: Method `B.func13` exceptions in the "Raises" section in the '
'docstring do not match those in the function body Raises values in the '
'docstring do not match those in the function body. Raised exceptions in the '
"docstring: ['ValueError', 'ValueError']. Raised exceptions in the body: "
"['ValueError'].",
'DOC503: Method `B.func14` exceptions in the "Raises" section in the '
'docstring do not match those in the function body Raises values in the '
'docstring do not match those in the function body. Raised exceptions in the '
"docstring: ['CustomError']. Raised exceptions in the body: "
"['exceptions.CustomError'].",
'DOC503: Method `B.func15` exceptions in the "Raises" section in the '
'docstring do not match those in the function body Raises values in the '
'docstring do not match those in the function body. Raised exceptions in the '
"docstring: ['CustomError']. Raised exceptions in the body: "
"['exceptions.m.CustomError'].",
]
Expand Down Expand Up @@ -870,7 +870,7 @@ def testRaisesPy310plus(style: str, skipRaisesCheck: bool) -> None:
'DOC501: Method `B.func10` has "raise" statements, but the docstring does not '
'have a "Raises" section',
'DOC503: Method `B.func10` exceptions in the "Raises" section in the '
'docstring do not match those in the function body Raises values in the '
'docstring do not match those in the function body. Raised exceptions in the '
"docstring: []. Raised exceptions in the body: ['ValueError'].",
]
expected1 = []
Expand Down
Loading