-
Notifications
You must be signed in to change notification settings - Fork 12
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
Developer documentation #259
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b21f794
doc: widen alabaster theme page and sidebar
jnikula b83a52d
doc: start developer documentation
jnikula 0595b45
doc: move contributing under developer documentation
jnikula c85df5e
doc: move testing README under developer documentation
jnikula dc25a89
readme: reference developer documentation
jnikula File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,8 @@ | ||
Contributing | ||
============ | ||
|
||
Hey, thanks for your interest in contributing to Hawkmoth! | ||
See `developer documentation`_ or contributing_. | ||
|
||
Here's some initial guidance to help you contribute, which is hopefully better | ||
than nothing. | ||
.. _developer documentation: https://jnikula.github.io/hawkmoth/dev/developer/ | ||
|
||
Broad Strokes | ||
------------- | ||
|
||
In short, keep it simple. | ||
|
||
Simplicity applies both to the use and implementation of Hawkmoth. If a feature | ||
gets complicated, it probably does not belong in Hawkmoth. There are big fancy | ||
projects such as Doxygen and Breathe out there to comprehensively document C and | ||
C++ projects in Sphinx, but they're complicated to use and understand. | ||
|
||
Design Checklist | ||
---------------- | ||
|
||
* Absolutely minimal parsing of the documentation comments. | ||
|
||
Contribution Checklist | ||
---------------------- | ||
|
||
* New or modified features need test coverage. Add or update the tests in the | ||
``test`` directory accordingly. See `test/README.rst`_ for an overview of the | ||
approach to testing. | ||
|
||
* Bug fixes need test coverage. Ideally add an expected failure test case | ||
demonstrating the bug first, and then fix it. | ||
|
||
* Make sure the tests pass for every commit:: | ||
|
||
make test | ||
|
||
or, to run the tests in a Docker container:: | ||
|
||
make docker-test | ||
|
||
* Make sure the static analysis (style checks, etc.) passes for every commit:: | ||
|
||
make check | ||
|
||
* User-visible changes need documentation. | ||
|
||
* Make sure the documentation build passes for every commit:: | ||
|
||
make html | ||
|
||
.. _test/README.rst: test/README.rst | ||
.. _contributing: doc/developer/contributing.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
.. _contributing: | ||
|
||
Contributing | ||
============ | ||
|
||
Hey, thanks for your interest in contributing to Hawkmoth! | ||
|
||
Here's some initial guidance to help you contribute, which is hopefully better | ||
than nothing. | ||
|
||
Broad Strokes | ||
------------- | ||
|
||
In short, keep it simple. | ||
|
||
Simplicity applies both to the use and implementation of Hawkmoth. If a feature | ||
gets complicated, it probably does not belong in Hawkmoth. There are big fancy | ||
projects such as Doxygen and Breathe out there to comprehensively document C and | ||
C++ projects in Sphinx, but they're complicated to use and understand. | ||
|
||
Design Checklist | ||
---------------- | ||
|
||
* Absolutely minimal parsing of the documentation comments. | ||
|
||
Contribution Checklist | ||
---------------------- | ||
|
||
* New or modified features need test coverage. Add or update the tests in the | ||
``test`` directory accordingly. See :ref:`testing` for an overview of the | ||
approach to testing. | ||
|
||
* Bug fixes need test coverage. Ideally add an expected failure test case | ||
demonstrating the bug first, and then fix it. | ||
|
||
* Make sure the tests pass for every commit:: | ||
|
||
make test | ||
|
||
or, to run the tests in a Docker container:: | ||
|
||
make docker-test | ||
|
||
* Make sure the static analysis (style checks, etc.) passes for every commit:: | ||
|
||
make check | ||
|
||
* User-visible changes need documentation. | ||
|
||
* Make sure the documentation build passes for every commit:: | ||
|
||
make html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.. _developer: | ||
|
||
Developer Documentation | ||
======================= | ||
|
||
Documentation for contributors and developers. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
contributing | ||
testing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
.. _testing: | ||
|
||
Testing | ||
======= | ||
|
||
This is a brief description of the approach to testing. | ||
|
||
The main idea is to compare documentation comments extracted from source to | ||
predefined, expected reStructuredText output. | ||
|
||
Test Files and Functions | ||
------------------------ | ||
|
||
There are three test files, with different levels and approaches, run by | ||
``pytest``: | ||
|
||
* ``test_parser()`` in ``test_parser.py`` | ||
|
||
Test the parser directly. The documentation comments are extracted through the | ||
parser Python interface. | ||
|
||
* ``test_cli()`` in ``test_cli.py`` | ||
|
||
Test the parser and the command-line interface. The documentation comments are | ||
extracted through the command-line interface. | ||
|
||
* ``test_extension_text()`` and ``test_extension_html()`` in | ||
``test_extension.py`` | ||
|
||
Test the parser and the Sphinx extension, using two builders: text and | ||
html. The documentation comments are extracted through the Sphinx build | ||
process, running the extension. | ||
|
||
The above test functions are parametrized to be run for each test case (see | ||
below). | ||
|
||
Each test file contains abstractions depending on the approach, calling the | ||
generic ``run_test()`` function in ``testenv.py``, making the test files and | ||
functions just a thin glue layer. | ||
|
||
Test Cases | ||
---------- | ||
|
||
The test functions described above are parametrized using what we call test | ||
cases. Each test case is defined by a ``.yaml`` file. The ``.yaml`` defines the | ||
configuration, the input C or C++ source file, the expected reStructuredText | ||
output file, and optionally a diagnostics (error messages) output file. | ||
|
||
The YAML is parsed using StrictYAML, using a schema defined in ``testenv.py``. | ||
|
||
The test approach, the relative path and the basename of the ``.yaml`` file | ||
define the parametrized test case name in ``pytest``, for example | ||
``test_parser[c/struct]``. | ||
|
||
Test Cases as Examples | ||
---------------------- | ||
|
||
The examples in the documentation are generated from test cases under the | ||
``examples`` subdirectory, ensuring the examples actually work. | ||
|
||
``make update-examples`` runs ``update_examples.py`` to generate | ||
``doc/examples.rst`` from the example test cases. | ||
|
||
Running | ||
------- | ||
|
||
Run tests using ``make test``. This calls ``pytest``. The ``pytest-xdist`` | ||
plugin parallelizes test execution. | ||
|
||
Running individual test approaches, for examples ``test_parser``:: | ||
|
||
$ pytest -k test_parser | ||
|
||
Run individual test cases, for example ``c/struct``:: | ||
|
||
$ pytest -k c/struct | ||
|
||
Combined, with verbose output, for example:: | ||
|
||
$ pytest -v -k test_cli[c/struct] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,8 @@ | ||
Testing | ||
======= | ||
|
||
This is a brief description of the approach to testing. | ||
See `developer documentation`_ or testing_. | ||
|
||
The main idea is to compare documentation comments extracted from source to | ||
predefined, expected reStructuredText output. | ||
.. _developer documentation: https://jnikula.github.io/hawkmoth/dev/developer/ | ||
|
||
Test Files and Functions | ||
------------------------ | ||
|
||
There are three test files, with different levels and approaches, run by | ||
``pytest``: | ||
|
||
* ``test_parser()`` in ``test_parser.py`` | ||
|
||
Test the parser directly. The documentation comments are extracted through the | ||
parser Python interface. | ||
|
||
* ``test_cli()`` in ``test_cli.py`` | ||
|
||
Test the parser and the command-line interface. The documentation comments are | ||
extracted through the command-line interface. | ||
|
||
* ``test_extension_text()`` and ``test_extension_html()`` in | ||
``test_extension.py`` | ||
|
||
Test the parser and the Sphinx extension, using two builders: text and | ||
html. The documentation comments are extracted through the Sphinx build | ||
process, running the extension. | ||
|
||
The above test functions are parametrized to be run for each test case (see | ||
below). | ||
|
||
Each test file contains abstractions depending on the approach, calling the | ||
generic ``run_test()`` function in ``testenv.py``, making the test files and | ||
functions just a thin glue layer. | ||
|
||
Test Cases | ||
---------- | ||
|
||
The test functions described above are parametrized using what we call test | ||
cases. Each test case is defined by a ``.yaml`` file. The ``.yaml`` defines the | ||
configuration, the input C or C++ source file, the expected reStructuredText | ||
output file, and optionally a diagnostics (error messages) output file. | ||
|
||
The YAML is parsed using StrictYAML, using a schema defined in ``testenv.py``. | ||
|
||
The test approach, the relative path and the basename of the ``.yaml`` file | ||
define the parametrized test case name in ``pytest``, for example | ||
``test_parser[c/struct]``. | ||
|
||
Test Cases as Examples | ||
---------------------- | ||
|
||
The examples in the documentation are generated from test cases under the | ||
``examples`` subdirectory, ensuring the examples actually work. | ||
|
||
``make update-examples`` runs ``update_examples.py`` to generate | ||
``doc/examples.rst`` from the example test cases. | ||
|
||
Running | ||
------- | ||
|
||
Run tests using ``make test``. This calls ``pytest``. The ``pytest-xdist`` | ||
plugin parallelizes test execution. | ||
|
||
Running individual test approaches, for examples ``test_parser``:: | ||
|
||
$ pytest -k test_parser | ||
|
||
Run individual test cases, for example ``c/struct``:: | ||
|
||
$ pytest -k c/struct | ||
|
||
Combined, with verbose output, for example:: | ||
|
||
$ pytest -v -k test_cli[c/struct] | ||
.. _testing: ../doc/developer/testing.rst |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are hidpi screens handled automatically through scaling? I think not, but bear in mind I know very little of CSS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not my strong suit either, and I can only justify this because the original Alabaster stylesheet uses px.