{"id":30152055,"url":"https://github.com/plone/code-quality","last_synced_at":"2025-08-11T11:11:12.617Z","repository":{"id":40383640,"uuid":"481252064","full_name":"plone/code-quality","owner":"plone","description":"Docker image to run code-quality checks","archived":false,"fork":false,"pushed_at":"2025-03-28T15:42:00.000Z","size":202,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-28T16:36:14.304Z","etag":null,"topics":["black","code-quality","docker","flake8","plone"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/plone/code-quality","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"plone"}},"created_at":"2022-04-13T14:34:23.000Z","updated_at":"2025-03-28T15:39:44.000Z","dependencies_parsed_at":"2025-03-28T16:29:50.129Z","dependency_job_id":"f12f40d0-bd13-488f-8c64-afb7cc7d185e","html_url":"https://github.com/plone/code-quality","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/plone/code-quality","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plone%2Fcode-quality","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plone%2Fcode-quality/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plone%2Fcode-quality/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plone%2Fcode-quality/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plone","download_url":"https://codeload.github.com/plone/code-quality/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plone%2Fcode-quality/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269873158,"owners_count":24488993,"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","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["black","code-quality","docker","flake8","plone"],"created_at":"2025-08-11T11:09:20.983Z","updated_at":"2025-08-11T11:11:12.585Z","avatar_url":"https://github.com/plone.png","language":"Python","funding_links":["https://github.com/sponsors/plone"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://hub.docker.com/r/plone/code-quality\"\u003e\n    \u003cimg alt=\"Plone Code Quality tool\" width=\"200px\" src=\"https://raw.githubusercontent.com/plone/code-quality/main/docs/icon.png\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\"\u003e\n  Plone Code Quality tool\n\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![Docker Image Version (latest semver)](https://img.shields.io/docker/v/plone/code-quality)](https://hub.docker.com/r/plone/code-quality)\n![GitHub Repo stars](https://img.shields.io/github/stars/plone/code-quality?style=flat-square)\n[![license badge](https://img.shields.io/github/license/plone/code-quality)](./LICENSE)\n\n\u003c/div\u003e\n\n## Configuration\n\nThis tool looks for configuration in a `pyproject.toml`file in the root of the codebase being analysed.\n\nThe default configuration values are:\n\n```toml\n[tool.plone-code-analysis]\ncheckers = [\"black\", \"flake8\", \"isort\", \"pyroma\", \"zpretty\"]\nformatters = [\"black\", \"isort\", \"zpretty\"]\npaths = \".\"\npaths_pyroma = \".\"\npaths_black = \".\"\npaths_flake8 = \".\"\npaths_isort = \".\"\npaths_pyroma = \".\"\npaths_zpretty = \".\"\n```\n\nIf you want to change only the `paths`, you should add to your `pyproject.toml` the following settings:\n\n```toml\n[tool.plone-code-analysis]\npaths = \"src/ setup.py\"\n```\nAlso, it is possible to change the paths used for individual tools:\n\n```toml\n[tool.plone-code-analysis]\npaths_black = \"src/ tests/ setup.py\"\npaths_flake8 = \"src/ setup.py\"\n```\n\nOr explicitly set `checkers` or `formatters` to be used:\n\n\n```toml\n[tool.plone-code-analysis]\ncheckers = [\"black\", \"flake8\", \"isort\", \"pyroma\", ]\nformatters = [\"black\", \"isort\",]\n```\n\n### Tools configuration\n\nTo configure black, flake8 (via flakeheaven) and isort, also use the `pyproject.toml` file in the root of the directory you are mounting.\n\nAn example configuration, used by this image, follows:\n\n```toml\n[tool.black]\nline-length = 88\ntarget-version = ['py38']\ninclude = '\\.pyi?$'\n\n[tool.isort]\nprofile = \"black\"\nforce_alphabetical_sort = true\nforce_single_line = true\nlines_after_imports = 2\nline_length = 120\n\n[tool.flakeheaven]\nformat=\"grouped\"\nmax_line_length=88\nshow_source=true\nmax-complexity=25\n\n[tool.flakeheaven.plugins]\npycodestyle = [\"+*\"]\npyflakes = [\"+*\"]\n\"flake8-*\" = [\"+*\"]\n\n[tool.plone-code-analysis]\npaths = \"docker-entrypoint.py src/setup.py src/plone_code_analysis tests/fixtures/packages/ok tests/package tests/conftest.py\"\npaths_pyroma = \"src/ tests/fixtures/packages/ok\"\n```\n\n## Usage\n\nFirst, go to the repository you want to check or format.\n\n### Checks / Linter\n\n#### Run all Checks\n\nUsing the configuration available in `pyproject.toml`, run:\n\n```bash\ndocker run --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest check\n```\n\n#### Check with [black](https://black.readthedocs.io/en/stable/)\n\nCheck with `pyproject.toml` settings:\n\n```bash\ndocker run --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest check black\n```\n\nExplicitly check **src** directory and **setup.py** file.\n\n```bash\ndocker run --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest check black src setup.py\n```\n\n#### Check with [flake8](https://flake8.pycqa.org/en/stable/)\n\nFlake8 checks, using [flakeheaven](https://pypi.org/project/flakeheaven/) configuration format.\n\nCurrent plugins in use:\n\n* [flake8-blind-except](https://pypi.org/project/flake8-blind-except/)\n* [flake8-debugger](https://pypi.org/project/flake8-debugger/)\n* [flake8-print](https://pypi.org/project/flake8-print/)\n\nCheck with `pyproject.toml` settings:\n\n```bash\ndocker run --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest check flake8\n```\n\nExplicitly check **src** directory and **setup.py** file.\n\n```bash\ndocker run --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest check flake8 src setup.py\n```\n\n#### Check with [isort](https://pycqa.github.io/isort/)\n\nCheck with `pyproject.toml` settings:\n\n```bash\ndocker run --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest check isort\n```\n\nExplicitly check **src** directory and **setup.py** file.\n\n```bash\ndocker run --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest check isort src setup.py\n```\n\n\n#### Check with [pyroma](https://pycqa.github.io/pyroma/)\n\nCheck with `pyproject.toml` settings:\n\n```bash\ndocker run --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest check pyroma\n```\n\nExplicitly check **src/mypackage** directory .\n\n```bash\ndocker run --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest check pyroma src/mypackage\n```\n\n#### Check with [zpretty](https://pypi.org/project/zpretty/)\n\nCheck with `pyproject.toml` settings:\n\n```bash\ndocker run --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest check zpretty\n```\n\nExplicitly check **src** directory .\n\n```bash\ndocker run --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest check zpretty src\n\n```\n\n### Formatter\n\nTo avoid rewriting the owner and group information of the formatted files, we need to pass the correct `--user` option to the `docker run` command.\n\nIn all examples bellow we use the `\"$(id -u $(whoami)):$(getent group $(whoami)|cut -d: -f3)\"` snippet to set the `--user` option to the current user running the formatter.\n\n#### Run all formatters\n\nUsing the configuration available in `pyproject.toml`, run:\n\n```bash\ndocker run --user=\"$(id -u $(whoami)):$(getent group $(whoami)|cut -d: -f3)\" --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest format\n```\n\n#### Format with [black](https://black.readthedocs.io/en/stable/)\n\nFormat with `pyproject.toml` settings:\n\n```bash\ndocker run --user=\"$(id -u $(whoami)):$(getent group $(whoami)|cut -d: -f3)\" --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest format black\n```\n\nExplicitly format **src** directory and **setup.py** file.\n\n```bash\ndocker run --user=\"$(id -u $(whoami)):$(getent group $(whoami)|cut -d: -f3)\" --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest format src setup.py\n```\n\n#### Format with [isort](https://pycqa.github.io/isort/)\n\nFormat with `pyproject.toml` settings:\n\n```bash\ndocker run --user=\"$(id -u $(whoami)):$(getent group $(whoami)|cut -d: -f3)\" --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest format isort\n```\n\nExplicitly format **src** directory and **setup.py** file.\n\n```bash\ndocker run --user=\"$(id -u $(whoami)):$(getent group $(whoami)|cut -d: -f3)\" --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest format src setup.py\n```\n\n#### Format with [zpretty](https://pypi.org/project/zpretty/)\n\nFormat with `pyproject.toml` settings:\n\n```bash\ndocker run --user=\"$(id -u $(whoami)):$(getent group $(whoami)|cut -d: -f3)\" --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest format zpretty\n```\n\nExplicitly format the **src** directory .\n\n```bash\ndocker run --user=\"$(id -u $(whoami)):$(getent group $(whoami)|cut -d: -f3)\" --rm -v \"${PWD}\":/github/workspace plone/code-quality:latest format src\n\n```\n\n## Contribute\n\n- [Issue Tracker](https://github.com/plone/code-quality/issues)\n- [Source Code](https://github.com/plone/code-quality/)\n- [Documentation](https://github.com/plone/code-quality/)\n\nPlease **DO NOT** commit to version branches directly. Even for the smallest and most trivial fix.\n\n**ALWAYS** open a pull request and ask somebody else to merge your code. **NEVER** merge it yourself.\n\n\n### Running linters on this codebase\n\nUse this tool to lint its own codebase:\n\n```shell\nmake lint-all\n```\n\nYou can also increase the verbosity with:\n\n```shell\nLOG_LEVEL=DEBUG make lint-all\n```\n### Running formatters on this codebase\n\nUse this tool to format its own codebase:\n\n```shell\nmake format\n```\n\nYou can also increase the verbosity with:\n\n```shell\nLOG_LEVEL=DEBUG make format\n```\n\n\n### Running local tests\n\nTests are implemented with `pytest` and can be run with:\n\n```shell\nmake build\nmake test\n```\n\n## Credits\n\nBased on a solution originally developed by [kitconcept GmbH](https://kitconcept.com).\n\n[![Plone Foundation](https://raw.githubusercontent.com/plone/.github/main/plone-foundation.png)](https://plone.org/)\n\n## License\n\nThe project is licensed under the GPLv2.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplone%2Fcode-quality","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplone%2Fcode-quality","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplone%2Fcode-quality/lists"}