Healthlane-Technologies / Zango

Django meta-framework for building enterprise-ready custom business applications 💼 ✨
https://zango.dev
Other
226 stars 48 forks source link

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

Open DevilsAutumn opened 3 weeks ago

DevilsAutumn commented 3 weeks ago

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.