Skip to content

Commit d2f2ee7

Browse files
authored
Fix Sphinx docs warnings (#116)
1 parent a315c88 commit d2f2ee7

File tree

12 files changed

+24
-15
lines changed

12 files changed

+24
-15
lines changed

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tests/_data/** filter=lfs diff=lfs merge=lfs -text

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ dist/
66
*.pyc
77
__pycache__/
88
.pytest_cache/
9-
tests/docs/api
10-
tests/docs/build
9+
tests/_docs/api
10+
tests/_docs/build
1111
.tox/

dissect/cstruct/types/enum.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ class Enum(BaseType, IntEnum, metaclass=EnumMetaType):
114114
Enums can be made using any integer type.
115115
116116
Example:
117-
When using the default C-style parser, the following syntax is supported:
117+
When using the default C-style parser, the following syntax is supported::
118118
119119
enum <name> [: <type>] {
120120
<values>
121121
};
122122
123-
For example, an enum that has A=1, B=5 and C=6 could be written like so:
123+
For example, an enum that has A=1, B=5 and C=6 could be written like so::
124124
125125
enum Test : uint16 {
126126
A, B=5, C

dissect/cstruct/types/flag.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ class Flag(BaseType, IntFlag, metaclass=EnumMetaType):
1515
Flags can be made using any integer type.
1616
1717
Example:
18-
When using the default C-style parser, the following syntax is supported:
18+
When using the default C-style parser, the following syntax is supported::
1919
2020
flag <name> [: <type>] {
2121
<values>
2222
};
2323
24-
For example, a flag that has A=1, B=4 and C=8 could be written like so:
24+
For example, a flag that has A=1, B=4 and C=8 could be written like so::
2525
2626
flag Test : uint16 {
2727
A, B=4, C

tests/_data/testdef.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:46fab39cf8ed080513ea9e193ba08174f0133e133d249e60e5d819eb396ec7a7
3+
size 32

tests/docs/Makefile tests/_docs/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# You can set these variables from the command line, and also
55
# from the environment for the first two.
6-
SPHINXOPTS ?= -jauto
6+
SPHINXOPTS ?= -jauto -w $(BUILDDIR)/warnings.log --fail-on-warning
77
SPHINXBUILD ?= sphinx-build
88
SOURCEDIR = .
99
BUILDDIR = build

tests/_docs/__init__.py

Whitespace-only changes.

tests/docs/conf.py tests/_docs/conf.py

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
project = "dissect.cstruct"
2+
13
extensions = [
24
"autoapi.extension",
35
"sphinx.ext.autodoc",
@@ -32,3 +34,9 @@
3234
autodoc_member_order = "groupwise"
3335

3436
autosectionlabel_prefix_document = True
37+
38+
suppress_warnings = [
39+
# https://github.com/readthedocs/sphinx-autoapi/issues/285
40+
"autoapi.python_import_resolution",
41+
"ref.python",
42+
]
File renamed without changes.

tests/data/testdef.txt

-3
This file was deleted.

tests/test_basic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_duplicate_type(cs: cstruct, compiled: bool) -> None:
2828

2929

3030
def test_load_file(cs: cstruct, compiled: bool) -> None:
31-
path = Path(__file__).parent / "data/testdef.txt"
31+
path = Path(__file__).parent / "_data/testdef.txt"
3232

3333
cs.loadfile(path, compiled=compiled)
3434
assert "test" in cs.typedefs

tox.ini

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ deps =
5454
sphinx-design
5555
furo
5656
commands =
57-
make -C tests/docs clean
58-
make -C tests/docs html
57+
make -C tests/_docs clean
58+
make -C tests/_docs html
5959

6060
[testenv:docs-linkcheck]
6161
allowlist_externals = make
6262
deps = {[testenv:docs-build]deps}
6363
commands =
64-
make -C tests/docs clean
65-
make -C tests/docs linkcheck
64+
make -C tests/_docs clean
65+
make -C tests/_docs linkcheck

0 commit comments

Comments
 (0)