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

Add interrogate pre-commit hook for docstring coverage. #365

Open
DevilsAutumn opened this issue Aug 20, 2024 · 0 comments
Open

Add interrogate pre-commit hook for docstring coverage. #365

DevilsAutumn opened this issue Aug 20, 2024 · 0 comments

Comments

@DevilsAutumn
Copy link
Contributor

Add the below in pre-commit-config.yml

- repo: https://github.com/econchick/interrogate
  rev: 1.7.0
  hooks:
    - id: interrogate
      args: [--fail-under=95]
      pass_filenames: true
      always_run: true

Create a new file pyproject.toml in root and add the contents from the file below:

pyproject.toml
[tool.interrogate]
ignore-init-method = false
ignore-init-module = false
ignore-magic = false
ignore-semiprivate = false
ignore-private = false
ignore-property-decorators = false
ignore-module = false
ignore-nested-functions = false
ignore-nested-classes = false
ignore-setters = false
ignore-overloaded-functions = false
fail-under = 80
# example values
exclude = [
    "docs",
    "build",
    "**/test",
    "**/tests",
    "examples",
    "frontend",
    "backend/test_project",
    "deploy",
    "**/auditlogs",
    "**/apps.py",
    "**/models.py",
    "**/views.py",
    "**/urls_public.py",
    "**/urls_tenants.py",
    "**/settings.py",
    "**/urls.py",
    "**/__init__.py",
    "**/tests.py",
    "**/serializers.py",
    "**/migrations",
    "**/migrations",
    "setup_project.py",
    "**/setup.py",
    "**/commands"
    ]
# example regex
ignore-regex = ["^get$", "^mock_.*", ".*BaseClass.*"]
ext = []
# possible values: sphinx (default), google
style = "google"
# possible values: 0 (minimal output), 1 (-v), 2 (-vv)
verbose = 1
quiet = false
whitelist-regex = []
color = true
omit-covered-files = false
# output file logation
# generate-badge = "."
# badge-format = "svg"

Now the most important part, docstring needs to be added in all the classes/methods that do not have proper coverage as reported by interrogate.

@DevilsAutumn DevilsAutumn changed the title Add interrogate github action for docstring coverage. Add interrogate pre-commit for docstring coverage. Aug 20, 2024
@DevilsAutumn DevilsAutumn changed the title Add interrogate pre-commit for docstring coverage. Add interrogate pre-commit hook for docstring coverage. Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant