Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Commit e5ec1a8

Browse files
committed
Add deprecation warnings for ConventionChecker
1 parent 0f250ba commit e5ec1a8

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/pydocstyle/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from pydocstyle.checker import check
1+
from pydocstyle.checker import check, check_source
22
from pydocstyle.violations import Error, conventions
33
from pydocstyle.utils import __version__
44

src/pydocstyle/checker.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Parsed source code checkers for docstring violations."""
22

33
import tokenize as tk
4+
import warnings
45

56
from pydocstyle import violations
67
from pydocstyle.checkers import get_checkers
@@ -9,11 +10,15 @@
910
from pydocstyle.utils import log
1011

1112

12-
__all__ = ('check', )
13+
__all__ = ('check', 'check_source')
1314

1415

1516
class ConventionChecker:
16-
"""Checker for PEP 257 and numpy conventions.
17+
"""Deprecated: Checker for PEP 257 and numpy conventions.
18+
19+
Deprecated class. Use `pydocstyle.check_source` instead.
20+
>>> from pydocstyle import check_source
21+
>>> check_source(source, filename, ignore_decorators=None)
1722
1823
D10x: Missing docstrings
1924
D20x: Whitespace issues
@@ -22,11 +27,18 @@ class ConventionChecker:
2227
2328
"""
2429

30+
def __init__(self):
31+
warnings.warn("`ConventionChecker` is deprecated. "
32+
"Use the `pydocstyle.check_source` instead", DeprecationWarning)
33+
2534
def check_source(self, source, filename, ignore_decorators=None):
35+
warnings.warn("`ConventionChecker.check_source` is deprecated. "
36+
"Use `pydocstyle.check_source` instead", DeprecationWarning)
2637
yield from check_source(source, filename, ignore_decorators=ignore_decorators)
2738

2839
@property
2940
def checks(self):
41+
warnings.warn("`ConventionChecker.checks` is deprecated.", DeprecationWarning)
3042
return _get_checks()
3143

3244

0 commit comments

Comments
 (0)