Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Sphinx docs warnings #116

Merged
merged 1 commit into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/_data/** filter=lfs diff=lfs merge=lfs -text
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ dist/
*.pyc
__pycache__/
.pytest_cache/
tests/docs/api
tests/docs/build
tests/_docs/api
tests/_docs/build
.tox/
4 changes: 2 additions & 2 deletions dissect/cstruct/types/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ class Enum(BaseType, IntEnum, metaclass=EnumMetaType):
Enums can be made using any integer type.

Example:
When using the default C-style parser, the following syntax is supported:
When using the default C-style parser, the following syntax is supported::

enum <name> [: <type>] {
<values>
};

For example, an enum that has A=1, B=5 and C=6 could be written like so:
For example, an enum that has A=1, B=5 and C=6 could be written like so::

enum Test : uint16 {
A, B=5, C
Expand Down
4 changes: 2 additions & 2 deletions dissect/cstruct/types/flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ class Flag(BaseType, IntFlag, metaclass=EnumMetaType):
Flags can be made using any integer type.

Example:
When using the default C-style parser, the following syntax is supported:
When using the default C-style parser, the following syntax is supported::

flag <name> [: <type>] {
<values>
};

For example, a flag that has A=1, B=4 and C=8 could be written like so:
For example, a flag that has A=1, B=4 and C=8 could be written like so::

flag Test : uint16 {
A, B=4, C
Expand Down
3 changes: 3 additions & 0 deletions tests/_data/testdef.txt
Git LFS file not shown
2 changes: 1 addition & 1 deletion tests/docs/Makefile → tests/_docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?= -jauto
SPHINXOPTS ?= -jauto -w $(BUILDDIR)/warnings.log --fail-on-warning
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = build
Expand Down
Empty file added tests/_docs/__init__.py
Empty file.
8 changes: 8 additions & 0 deletions tests/docs/conf.py → tests/_docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
project = "dissect.cstruct"

extensions = [
"autoapi.extension",
"sphinx.ext.autodoc",
Expand Down Expand Up @@ -32,3 +34,9 @@
autodoc_member_order = "groupwise"

autosectionlabel_prefix_document = True

suppress_warnings = [
# https://github.com/readthedocs/sphinx-autoapi/issues/285
"autoapi.python_import_resolution",
"ref.python",
]
File renamed without changes.
3 changes: 0 additions & 3 deletions tests/data/testdef.txt

This file was deleted.

2 changes: 1 addition & 1 deletion tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_duplicate_type(cs: cstruct, compiled: bool) -> None:


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

cs.loadfile(path, compiled=compiled)
assert "test" in cs.typedefs
Expand Down
8 changes: 4 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ deps =
sphinx-design
furo
commands =
make -C tests/docs clean
make -C tests/docs html
make -C tests/_docs clean
make -C tests/_docs html

[testenv:docs-linkcheck]
allowlist_externals = make
deps = {[testenv:docs-build]deps}
commands =
make -C tests/docs clean
make -C tests/docs linkcheck
make -C tests/_docs clean
make -C tests/_docs linkcheck
Loading