Skip to content

Commit 7092bfb

Browse files
committed
Configure snippet-fmt
1 parent 2016f79 commit 7092bfb

File tree

3 files changed

+50
-23
lines changed

3 files changed

+50
-23
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,13 @@ repos:
6767
- id: remove-crlf
6868
- id: forbid-crlf
6969

70-
- repo: https://github.com/repo-helper/formate
71-
rev: v0.4.3
70+
- repo: https://github.com/python-formate/snippet-fmt
71+
rev: v0.1.1
72+
hooks:
73+
- id: snippet-fmt
74+
75+
- repo: https://github.com/python-formate/formate
76+
rev: v0.4.9
7277
hooks:
7378
- id: formate
7479
exclude: ^(doc-source/conf|__pkginfo__|setup)\.(_)?py$

doc-source/style.rst

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ Function signatures
3131

3232
Function signatures should be laid out like this:
3333

34-
.. code-block:: python
34+
.. code-block:: python3
3535
3636
def long_function_name(
37-
var_one: str,
38-
var_two: int,
39-
var_three: List[str],
40-
var_four: Dict[str, Any],
41-
) -> Iterable[Tuple[str, int]]:
37+
var_one: str,
38+
var_two: int,
39+
var_three: List[str],
40+
var_four: Dict[str, Any],
41+
) -> Iterable[Tuple[str, int]]:
4242
...
4343
4444
with each argument on its own line, and the function name and return annotatons on separate lines.
4545
Ensure to include the trailing comma after the last argument's annotation.
4646
If the signature is short enough it may be placed on one line:
4747

48-
.. code-block:: python
48+
.. code-block:: python3
4949
5050
def function_name(var_one: str, var_two: int) -> bool:
5151
...
@@ -82,23 +82,25 @@ Long Sequences
8282

8383
Long sequences should be written with each element on its own line and a trailing comma after the last element:
8484

85-
.. code-block:: python
85+
.. code-block:: python3
8686
8787
# Bad
8888
my_list = [
89-
1, 2, 3,
90-
4, 5, 6
91-
]
89+
1, 2, 3,
90+
4, 5, 6
91+
]
92+
93+
.. code-block:: python
9294
9395
# Good
9496
my_list = [
95-
1,
96-
2,
97-
3,
98-
4,
99-
5,
100-
6,
101-
]
97+
1,
98+
2,
99+
3,
100+
4,
101+
5,
102+
6,
103+
]
102104
103105
104106
Maximum Line Length
@@ -166,15 +168,15 @@ Docstrings
166168

167169
The first line of the docstring must start a new line:
168170

169-
.. code-block:: python
171+
.. code-block:: python3
170172
171173
# Bad:
172-
173174
"""Return a foobang
174175
"""
175176
176-
# Good:
177+
.. code-block:: python
177178
179+
# Good:
178180
"""
179181
Return a foobang
180182
"""

pyproject.toml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,23 @@ autodoc_exclude_members = [
114114
"__abstractmethods__",
115115
"__hash__",
116116
]
117+
118+
[tool.mypy]
119+
python_version = "3.8"
120+
namespace_packages = true
121+
check_untyped_defs = true
122+
warn_unused_ignores = true
123+
no_implicit_optional = true
124+
125+
[tool.snippet-fmt]
126+
directives = [ "code-block",]
127+
128+
[tool.snippet-fmt.languages.python]
129+
reformat = true
130+
131+
[tool.snippet-fmt.languages.TOML]
132+
reformat = true
133+
134+
[tool.snippet-fmt.languages.ini]
135+
136+
[tool.snippet-fmt.languages.json]

0 commit comments

Comments
 (0)