{"id":27114593,"url":"https://github.com/gtkacz/coverage-pre-commit","last_synced_at":"2025-04-07T03:59:04.155Z","repository":{"id":282672937,"uuid":"949260101","full_name":"gtkacz/coverage-pre-commit","owner":"gtkacz","description":"A pre-commit hook to run coverage on your code and enforce a minimum coverage threshold.","archived":false,"fork":false,"pushed_at":"2025-03-31T20:33:17.000Z","size":67,"stargazers_count":3,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T21:34:00.088Z","etag":null,"topics":["coverage","pre-commit","python","test","testing","testing-tools"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gtkacz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-16T03:15:14.000Z","updated_at":"2025-03-24T04:09:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"d6e637f4-11fb-4bca-90ff-54e20143f179","html_url":"https://github.com/gtkacz/coverage-pre-commit","commit_stats":null,"previous_names":["gtkacz/coverage-pre-commit"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtkacz%2Fcoverage-pre-commit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtkacz%2Fcoverage-pre-commit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtkacz%2Fcoverage-pre-commit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gtkacz%2Fcoverage-pre-commit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gtkacz","download_url":"https://codeload.github.com/gtkacz/coverage-pre-commit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247589774,"owners_count":20963024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coverage","pre-commit","python","test","testing","testing-tools"],"created_at":"2025-04-07T03:59:03.618Z","updated_at":"2025-04-07T03:59:04.150Z","avatar_url":"https://github.com/gtkacz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# coverage-pre-commit\n\nA pre-commit hook to run coverage on your code and enforce a minimum coverage threshold.\n\n## Features\n\n* **Multiple Test Providers**: Supports both unittest and pytest, with the ability to add custom providers\n* **Flexible Configuration**: Customize coverage thresholds, test command arguments, and more\n* **Dependency Management**: Automatically checks and installs required dependencies\n* **Pre-commit Integration**: Works seamlessly with pre-commit hooks\n\n## Usage\n\nAdd this to your `.pre-commit-config.yaml`:\n\n```yaml\n-   repo: https://github.com/gtkacz/coverage-pre-commit\n    rev: v0.1.0  # Use the ref you want to point at\n    hooks:\n    -   id: coverage-pre-commit\n```\n\n### Arguments\n\n```console\n$ coverage_pre_commit --help\nusage: coverage_pre_commit [-h] [--version] [--provider PROVIDER] [--args ARGS]\n                           [--fail-under FAIL_UNDER]\n                           [--extra-dependencies EXTRA_DEPENDENCIES]\n                           [--command COMMAND]\n\nRun tests with coverage and verify coverage thresholds\n\noptions:\n  -h, --help            show this help message and exit\n  --version             Show version information\n  --provider PROVIDER   Test provider\n  --args ARGS           Additional arguments to pass to the test command\n  --fail-under FAIL_UNDER\n                        Minimum coverage percentage to fail the build\n  --extra-dependencies EXTRA_DEPENDENCIES\n                        Additional dependencies to install\n  --command COMMAND     Custom command to run tests (required if provider is not supported)\n```\n\n### Example Usage\n\n#### With unittest\n\n```yaml\n-   repo: https://github.com/gtkacz/coverage-pre-commit\n    rev: v0.1.0\n    hooks:\n    -   id: coverage-pre-commit\n        args: [--fail-under=80]\n```\n\n#### With pytest\n\n```yaml\n-   repo: https://github.com/gtkacz/coverage-pre-commit\n    rev: v0.1.0\n    hooks:\n    -   id: coverage-pre-commit\n        args: [--provider=pytest, --fail-under=80, --extra-dependencies=pytest-xdist]\n```\n\n#### With custom command\n\n```yaml\n-   repo: https://github.com/gtkacz/coverage-pre-commit\n    rev: v0.1.0\n    hooks:\n    -   id: coverage-pre-commit\n        args: [--command=\"coverage run --branch manage.py test\"]\n```\n\n## Supported Providers\n\n- **unittest**: Uses Python's built-in unittest framework with coverage\n- **pytest**: Uses pytest with pytest-cov plugin\n\n## Contributing\n\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\nIf you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag \"enhancement\".\nDon't forget to give the project a star! Thanks again!\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n### Top contributors:\n\n\u003ca href=\"https://github.com/gtkacz/coverage-pre-commit/graphs/contributors\"\u003e\n  \u003cimg src=\"https://contrib.rocks/image?repo=gtkacz/coverage-pre-commit\" alt=\"contrib.rocks image\" /\u003e\n\u003c/a\u003e\n\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n\n## Contact\n\nGabriel Mitelman Tkacz - [@gtkacz](https://github.com/gtkacz) - gmtkacz@proton.me\n\nProject Link: [https://github.com/gtkacz/coverage-pre-commit](https://github.com/gtkacz/coverage-pre-commit)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgtkacz%2Fcoverage-pre-commit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgtkacz%2Fcoverage-pre-commit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgtkacz%2Fcoverage-pre-commit/lists"}