docsig 0.53.2__tar.gz → 0.53.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: docsig
3
- Version: 0.53.2
3
+ Version: 0.53.3
4
4
  Summary: Check signature params for proper documentation
5
5
  Home-page: https://pypi.org/project/docsig/
6
6
  License: MIT
@@ -222,7 +222,7 @@ It can be added to your .pre-commit-config.yaml as follows:
222
222
 
223
223
  repos:
224
224
  - repo: https://github.com/jshwi/docsig
225
- rev: v0.53.2
225
+ rev: v0.53.3
226
226
  hooks:
227
227
  - id: docsig
228
228
  args:
@@ -194,7 +194,7 @@ It can be added to your .pre-commit-config.yaml as follows:
194
194
 
195
195
  repos:
196
196
  - repo: https://github.com/jshwi/docsig
197
- rev: v0.53.2
197
+ rev: v0.53.3
198
198
  hooks:
199
199
  - id: docsig
200
200
  args:
@@ -83,11 +83,38 @@ class Failure(_t.List[str]):
83
83
  doc = func.docstring.args.get(index)
84
84
  self._description_syntax(doc)
85
85
  self._indent_syntax(doc)
86
- self._incorrect(doc)
87
- if arg != doc:
88
- self._order(arg, doc)
89
- self._misspelled(arg, doc)
90
- self._not_equal(arg, doc)
86
+
87
+ if doc.name == _UNNAMED:
88
+ # if the parameter does not have a name, but exists,
89
+ # then it must be incorrectly documented
90
+ # prior implementation relied on the docstring
91
+ # parameter equalling the signature parameter
92
+ self._add(_E[107])
93
+
94
+ elif arg != doc:
95
+ if any(
96
+ arg.name == i.name for i in self._func.docstring.args
97
+ ) or any(
98
+ doc.name == i.name for i in self._func.signature.args
99
+ ):
100
+ # parameters out of order
101
+ self._add(_E[101])
102
+
103
+ elif (
104
+ arg.name is not None
105
+ and doc.name is not None
106
+ and not self._errors
107
+ and _almost_equal(
108
+ arg.name, doc.name, _MIN_MATCH, _MAX_MATCH
109
+ )
110
+ ):
111
+ # spelling error found in documented parameter
112
+ self._add(_E[112])
113
+
114
+ elif arg.name is not None and doc.name is not None:
115
+ # documented parameter not equal to its
116
+ # respective argument
117
+ self._add(_E[110])
91
118
 
92
119
  self.sort()
93
120
 
@@ -103,12 +130,6 @@ class Failure(_t.List[str]):
103
130
  if value not in self._disable and message not in self:
104
131
  super().append(message)
105
132
 
106
- def _order(self, sig: _Param, doc: _Param) -> None:
107
- if any(sig.name == i.name for i in self._func.docstring.args) or any(
108
- doc.name == i.name for i in self._func.signature.args
109
- ):
110
- self._add(_E[101])
111
-
112
133
  def _exists(self) -> None:
113
134
  # pop the parameters that do not exist so that they are excluded
114
135
  # from further analysis, that way there are no additional, and
@@ -185,32 +206,10 @@ class Failure(_t.List[str]):
185
206
 
186
207
  self._add(_E[105], hint=hint)
187
208
 
188
- def _incorrect(self, doc: _Param) -> None:
189
- # if the parameter does not have a name, but exists, then it
190
- # must be incorrectly documented
191
- # prior implementation relied on the docstring parameter
192
- # equalling the signature parameter
193
- if doc.name == _UNNAMED:
194
- self._add(_E[107])
195
-
196
- # final catch-all
197
- def _not_equal(self, sig: _Param, doc: _Param) -> None:
198
- if sig.name is not None and doc.name is not None and not self._errors:
199
- self._add(_E[110])
200
-
201
209
  def _class_return(self) -> None:
202
210
  if self._func.docstring.returns and self._func.isinit:
203
211
  self._add(_E[111], hint=True)
204
212
 
205
- def _misspelled(self, sig: _Param, doc: _Param) -> None:
206
- if (
207
- sig.name is not None
208
- and doc.name is not None
209
- and not self._errors
210
- and _almost_equal(sig.name, doc.name, _MIN_MATCH, _MAX_MATCH)
211
- ):
212
- self._add(_E[112])
213
-
214
213
  def _description_syntax(self, doc: _Param) -> None:
215
214
  if doc.description is not None and not doc.description.startswith(" "):
216
215
  self._add(_E[115])
@@ -8,4 +8,4 @@ Allows for access to the version internally without cyclic imports
8
8
  caused by accessing it through __init__.
9
9
  """
10
10
 
11
- __version__ = "0.53.2"
11
+ __version__ = "0.53.3"
@@ -5,15 +5,6 @@ requires = [
5
5
  ]
6
6
 
7
7
  [tool.black]
8
- exclude = '''
9
- /(
10
- | \.git
11
- | \.mypy_cache
12
- | _build
13
- | build
14
- | dist
15
- )/
16
- '''
17
8
  line-length = 79
18
9
 
19
10
  [tool.codespell]
@@ -32,10 +23,21 @@ omit = [
32
23
  "whitelist.py"
33
24
  ]
34
25
 
26
+ [tool.deptry.per_rule_ignores]
27
+ DEP004 = ["yaml"]
28
+
29
+ [tool.docformatter]
30
+ in-place = true
31
+ wrap-summaries = 72
32
+
35
33
  [tool.docsig]
36
34
  check-class = true
37
35
  check-protected-class-methods = true
38
36
 
37
+ [tool.flynt]
38
+ line-length = 79
39
+ transform-concats = true
40
+
39
41
  [tool.isort]
40
42
  ensure_newline_before_comments = true
41
43
  force_grid_wrap = 0
@@ -45,6 +47,14 @@ multi_line_output = 3
45
47
  profile = "black"
46
48
  use_parentheses = true
47
49
 
50
+ [tool.mypy]
51
+ exclude = [
52
+ "whitelist\\.py"
53
+ ]
54
+ ignore_missing_imports = true
55
+ install_types = true
56
+ non_interactive = true
57
+
48
58
  [tool.poetry]
49
59
  authors = [
50
60
  "jshwi <stephen@jshwisolutions.com>"
@@ -66,7 +76,7 @@ maintainers = [
66
76
  name = "docsig"
67
77
  readme = "README.rst"
68
78
  repository = "https://github.com/jshwi/docsig"
69
- version = "0.53.2"
79
+ version = "0.53.3"
70
80
 
71
81
  [tool.poetry.dependencies]
72
82
  Sphinx = "^7.0.0"
@@ -76,57 +86,62 @@ click = "^8.1.7"
76
86
  pathspec = "^0.12.1"
77
87
  python = "^3.8"
78
88
 
79
- [tool.poetry.dev-dependencies]
89
+ [tool.poetry.group.dev.dependencies]
90
+ black = "^24.4.2"
80
91
  bump2version = "^1.0.1"
81
92
  deptry = "^0.16.1"
93
+ docformatter = "^1.7.5"
94
+ flynt = "^1.0.1"
95
+ isort = "^5.13.2"
96
+ mypy = "^1.10.0"
97
+ pre-commit = "^3.3.3"
98
+ pylint = "^3.1.0"
99
+ tox = "^4.15.0"
100
+ vulture = "^2.11"
101
+
102
+ [tool.poetry.group.docs.dependencies]
82
103
  furo = "^2024.4.27"
83
- ipython = "^8.12.0"
84
104
  myst-parser = "^3.0.1"
85
- pre-commit = "^3.3.3"
86
- pyaud = "^7.5.0"
87
- pytest-randomly = "^3.13.0"
105
+ pytest = "^8.2.0"
106
+ pyyaml = "^6.0.1"
107
+ sphinx-copybutton = "^0.5.2"
108
+ sphinx-markdown-builder = ">=0.5.5,<0.7.0"
109
+ templatest = "^0.10.1"
110
+
111
+ [tool.poetry.group.tests.dependencies]
112
+ pytest = "^8.2.0"
113
+ pytest-benchmark = "^4.0.0"
114
+ pytest-cov = "^5.0.0"
115
+ pytest-randomly = "^3.15.0"
88
116
  pytest-sugar = "^1.0.0"
89
117
  pytest-xdist = "^3.6.1"
90
- restview = "^3.0.0"
91
- sphinx-copybutton = "^0.5.2"
92
- sphinx-toolbox = "^3.5.0"
93
118
  templatest = "^0.10.1"
94
- tox = "^4.15.0"
95
119
 
96
120
  [tool.poetry.scripts]
97
121
  docsig = "docsig.__main__:main"
98
122
 
99
- [tool.pyaud]
100
- audit = [
101
- "commit-policy",
102
- "copyright-year",
103
- "format",
104
- "format-docs",
105
- "format-str",
106
- "imports",
107
- "lint",
108
- "test",
109
- "typecheck",
110
- "unused",
111
- "whitelist"
123
+ [tool.pylint.options]
124
+ disable = [
125
+ "consider-using-f-string",
126
+ "fixme"
112
127
  ]
113
- exclude = '''
114
- (?x)^(
115
- | docs\/conf\.py
116
- | whitelist\.py
117
- | scripts\/.*
118
- )$
119
- '''
128
+ ignore-patterns = [
129
+ 'conf\.py',
130
+ 'whitelist\.py'
131
+ ]
132
+ min-similarity-lines = 9
120
133
 
121
134
  [tool.pytest.ini_options]
122
135
  addopts = [
123
136
  "--color=yes",
124
137
  "--cov-report=term-missing",
125
138
  "--durations=5",
126
- "-n=auto",
127
139
  "-vv"
128
140
  ]
129
141
  filterwarnings = "ignore::DeprecationWarning"
142
+ markers = [
143
+ "benchmark: Marks tests as benchmarks"
144
+ ]
130
145
  norecursedirs = [
131
146
  ".git",
132
147
  ".idea",
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes