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

docs: add make docs target to generate inheritance/call graphs via Doxygen #1484

Merged
merged 3 commits into from
May 25, 2022

Conversation

cfm
Copy link
Member

@cfm cfm commented Apr 28, 2022

Description

Adds a make docs target to generate Doxygen documentation from Python sources and docstrings. After #1452 (comment), my particular interest here is in its class-inheritance and function-call graphs.

User story: As a developer, I want to be able to see diagrams of the call/caller relationships among functions and the inheritance relationships among classes, so that I can explore (and observe architectural smells in) the codebase visually.

If we ever were to publish this kind of documentation—for example, for securedrop-sdk—we'd probably go with Sphinx as the default in the Python ecosystem. I went with Doxygen here because it has built-in support for generating (the Graphviz source for) these graphs, whereas Sphinx requires an extension like Pyan. For an optional development tool, my weak preference is for (a) apt install doxygen graphviz over (b) pip install sphinx pyan3 which depends on apt install graphviz anyway.

Test Plan

On this branch:

$ make docs
doxygen(1) is not available in your $PATH.  Is it installed?
make: *** [Makefile:195: docs] Error 1
  • make docs fails gracefully without Doxygen installed.
  • Install Doxygen: sudo apt install doxygen
$ make docs
Graphviz's dot(1) is not available in your $PATH.  Is it installed?
make: *** [Makefile:196: docs] Error 1
  • make docs fails gracefully without Graphviz installed.
  • Install Graphviz: sudo apt install graphviz
$ make docs
[...]
finished...
Now open "/home/user/securedrop-client/docs/html/index.html" in your browser.
  • make docs succeeds, including underlying dot invocations.
  • The named file opens in your browser.
  • ClassesClasses List is full of classes.
  • securedrop_clientapi_jobsbaseApiJob shows:
    • an inheritance diagram for ApiJob subclasses; and
    • a collaboration diagram for ApiJobQueueJobQObject.

Checklist

If these changes modify code paths involving cryptography, the opening of files in VMs or network (via the RPC service) traffic, Qubes testing in the staging environment is required. For fine tuning of the graphical user interface, testing in any environment in Qubes is required. Please check as applicable:

  • I have tested these changes in the appropriate Qubes environment
  • I do not have an appropriate Qubes OS workstation set up (the reviewer will need to test these changes)
  • These changes should not need testing in Qubes

If these changes add or remove files other than client code, the AppArmor profile may need to be updated. Please check as applicable:

  • I have updated the AppArmor profile
  • No update to the AppArmor profile is required for these changes
  • I don't know and would appreciate guidance

If these changes modify the database schema, you should include a database migration. Please check as applicable:

  • I have written a migration and upgraded a test database based on main and confirmed that the migration applies cleanly
  • I have written a migration but have not upgraded a test database based on main and would like the reviewer to do so
  • I need help writing a database migration
  • No database schema changes are needed

@cfm cfm requested a review from a team as a code owner April 28, 2022 18:59
@cfm cfm added small off-sprint PR maintainer quality of life Usually small enhancements to make maintenance easier. labels Apr 28, 2022
@cfm cfm added this to Ready for Review in SecureDrop Team Board Apr 28, 2022
Copy link
Contributor

@eaon eaon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Graphs are 🆒

@eaon eaon moved this from Ready for Review to Done in SecureDrop Team Board May 25, 2022
@eaon eaon merged commit 1c5482b into main May 25, 2022
@eaon eaon deleted the call-graphs branch May 25, 2022 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintainer quality of life Usually small enhancements to make maintenance easier. small off-sprint PR
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants