

Measure docstring coverage of Python packages with GitHub Actions
source link: https://dev.to/epassaro/measure-docstring-coverage-of-python-packages-with-github-actions-1cp8
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Posted on Nov 19
Measure docstring coverage of Python packages with GitHub Actions
My Workflow
Maintainers should enforce collaborators to document their changes.
This workflow fails when the docstring coverage is lower than the score of the base branch (on pull requests) or the previous commit (on push), and files that made the job fail are blamed.
Pushing changes to the main branch should update the current coverage of the project by creating a dynamic badge through the shields.io endpoint.
Also, it's possible to define the range of the badge color based on the coverage results.
Submission Category:
Maintainer Must-Haves
Yaml File or Link to Code
epassaro
/
docstr-cov-workflow
Measure docstring coverage of Python packages with GitHub Actions
docstr-cov-workflow
Measure docstring coverage of Python packages with GitHub Actions
Usage
- Copy
.github/workflows/docstr-cov.yml
and.docstr.yaml
to your repository. - Tweak the configuration file following the package documentation.
- Login to https://jsonbin.org and store the API key as a repository secret named
JSONBIN_APIKEY
. - The workflow will fail if the coverage is lower than the score of the base branch (on
pull_request
) or the previous commit (onpush
), and files that made the job fail will be blamed. - Pushing to
main
branch updates the current coverage of the project by updating a nice badge. - You can change the color range of the badge by tweaking the
RANGE
variable at the top of the workflow. For example,50..75
means that coverage below50
will display a red badge, and above75
a green one. - Remember to add the badge to your README.md
Example
Make changes to example/base.py
and see the workflow…
Additional Resources / Info
An older version of this workflow is currently used by TARDIS-SN, a Montecarlo radiative transfer code that creates synthetic spectra for supernovae.
Recommend
-
127
Early Access Program Features GoLand EAP 19: Docs in Param Info, Cove...
-
96
README.rst pydocstring.vim
-
10
Stuck with TravisCI? Looking for a worthy alternative to GitLab CI? Here’s a guide on how to create a full CI pipeline publishing GitHub Packages, Codecov reports, releasing to Maven Central and GitHub, including dynamic commitlogs.Gi...
-
6
如何修改Elisp函数中的docstring Elisp提供了 documentation 函数可以用来获取另一个函数的docstring,然而可惜它是不能通过 setf 修改的: (defun foo () "Old Docstring") (documentation 'foo) ;; =>...
-
9
Managing Node.js Docker images in GitHub Packages using GitHub Actions Liran Tal July 13, 2021 If...
-
5
Code Coverage: How to Measure You've Done Enough TestingNovember 15th 2021 new story4A program with...
-
5
GitHub 全家桶:Actions 自动构建多架构 Docker 镜像并上传至 Packages (ghcr.io) 2021-11-24 Category:
-
12
Code coverage is a useless target measure by Mark Seemann Aiming for a particular percentage of code coverage is counter-productive. It's the end of 2015, and here I tho...
-
11
How to Measure Your Type Coverage 2022-11-07 When we come to a new code base, we...
-
7
1 NPM_TOKEN Add an NPM_TOKEN secret on GitHub. Get your secret key from the NPM dashboard. 2 Add a step to your action - name: Authenticate with private NPM package run: echo "//registry.npm...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK