Skip to content

Commit 1f2ea57

Browse files
authored
Fix wording in DOC503 violation message (#204)
1 parent 91263b8 commit 1f2ea57

File tree

6 files changed

+18
-15
lines changed

6 files changed

+18
-15
lines changed

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# Change Log
22

3-
## [Unpublished] - 2025-01-12
3+
## [0.5.18] - 2025-01-12
44

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

912
## [0.5.17] - 2025-01-12
1013

pydoclint/utils/violation.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

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

5959
601: 'Class docstring contains fewer class attributes than actual class attributes.',
6060
602: 'Class docstring contains more class attributes than in actual class attributes.',

pydoclint/utils/visitor_helper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ def addMismatchedRaisesExceptionViolation(
568568
body and docstring
569569
"""
570570
msgPostfix: str = (
571-
f'Raises values in the docstring: {docRaises}.'
571+
f'Raised exceptions in the docstring: {docRaises}.'
572572
f' Raised exceptions in the body: {actualRaises}.'
573573
)
574574
violations.append(

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = pydoclint
3-
version = 0.5.17
3+
version = 0.5.18
44
description = A Python docstring linter that checks arguments, returns, yields, and raises sections
55
long_description = file: README.md
66
long_description_content_type = text/markdown

tests/test_baseline.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,8 @@ def testSomeViolationsAreFixedButNewViolationsOccur(
285285
'DOC501: Function `bad_docstring_func` has "raise" statements, but'
286286
' the docstring does not have a "Raises" section',
287287
'DOC503: Function `bad_docstring_func` exceptions in the "Raises"'
288-
' section in the docstring do not match those in the function body'
289-
' Raises values in the docstring: []. Raised'
288+
' section in the docstring do not match those in the function body.'
289+
' Raised exceptions in the docstring: []. Raised'
290290
" exceptions in the body: ['ValueError'].",
291291
]
292292

tests/test_main.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ def testAllowInitDocstring(style: str) -> None:
610610
'DOC305: Class `C`: Class docstring has a "Raises" section; please put it in '
611611
'the __init__() docstring',
612612
'DOC503: Method `C.__init__` exceptions in the "Raises" section in the '
613-
'docstring do not match those in the function body Raises values in the '
613+
'docstring do not match those in the function body. Raised exceptions in the '
614614
"docstring: ['TypeError']. Raised exceptions in the body: ['ValueError'].",
615615
'DOC306: Class `D`: The class docstring does not need a "Yields" section, '
616616
'because __init__() cannot yield anything',
@@ -808,10 +808,10 @@ def testRaises(style: str, skipRaisesCheck: bool) -> None:
808808
'DOC501: Method `B.func1` has "raise" statements, but the docstring does not '
809809
'have a "Raises" section',
810810
'DOC503: Method `B.func1` exceptions in the "Raises" section in the docstring '
811-
'do not match those in the function body Raises values in the docstring: []. '
811+
'do not match those in the function body. Raised exceptions in the docstring: []. '
812812
"Raised exceptions in the body: ['ValueError'].",
813813
'DOC503: Method `B.func4` exceptions in the "Raises" section in the docstring '
814-
'do not match those in the function body Raises values in the docstring: '
814+
'do not match those in the function body. Raised exceptions in the docstring: '
815815
"['CurtomError']. Raised exceptions in the body: ['CustomError'].",
816816
'DOC502: Method `B.func5` has a "Raises" section in the docstring, but there '
817817
'are not "raise" statements in the body',
@@ -822,22 +822,22 @@ def testRaises(style: str, skipRaisesCheck: bool) -> None:
822822
'DOC501: Function `inner9a` has "raise" statements, but the docstring does '
823823
'not have a "Raises" section',
824824
'DOC503: Function `inner9a` exceptions in the "Raises" section in the '
825-
'docstring do not match those in the function body Raises values in the '
825+
'docstring do not match those in the function body. Raised exceptions in the '
826826
"docstring: []. Raised exceptions in the body: ['FileNotFoundError'].",
827827
'DOC503: Method `B.func11` exceptions in the "Raises" section in the '
828-
'docstring do not match those in the function body Raises values in the '
828+
'docstring do not match those in the function body. Raised exceptions in the '
829829
"docstring: ['TypeError']. Raised exceptions in the body: ['TypeError', "
830830
"'ValueError'].",
831831
'DOC503: Method `B.func13` exceptions in the "Raises" section in the '
832-
'docstring do not match those in the function body Raises values in the '
832+
'docstring do not match those in the function body. Raised exceptions in the '
833833
"docstring: ['ValueError', 'ValueError']. Raised exceptions in the body: "
834834
"['ValueError'].",
835835
'DOC503: Method `B.func14` exceptions in the "Raises" section in the '
836-
'docstring do not match those in the function body Raises values in the '
836+
'docstring do not match those in the function body. Raised exceptions in the '
837837
"docstring: ['CustomError']. Raised exceptions in the body: "
838838
"['exceptions.CustomError'].",
839839
'DOC503: Method `B.func15` exceptions in the "Raises" section in the '
840-
'docstring do not match those in the function body Raises values in the '
840+
'docstring do not match those in the function body. Raised exceptions in the '
841841
"docstring: ['CustomError']. Raised exceptions in the body: "
842842
"['exceptions.m.CustomError'].",
843843
]
@@ -870,7 +870,7 @@ def testRaisesPy310plus(style: str, skipRaisesCheck: bool) -> None:
870870
'DOC501: Method `B.func10` has "raise" statements, but the docstring does not '
871871
'have a "Raises" section',
872872
'DOC503: Method `B.func10` exceptions in the "Raises" section in the '
873-
'docstring do not match those in the function body Raises values in the '
873+
'docstring do not match those in the function body. Raised exceptions in the '
874874
"docstring: []. Raised exceptions in the body: ['ValueError'].",
875875
]
876876
expected1 = []

0 commit comments

Comments
 (0)