{"id":32527067,"url":"https://github.com/steinuil/black-codeclimate","last_synced_at":"2026-05-15T08:03:49.295Z","repository":{"id":224588226,"uuid":"763690574","full_name":"steinuil/black-codeclimate","owner":"steinuil","description":"Convert black --diff output into a Code Climate report","archived":false,"fork":false,"pushed_at":"2024-02-27T12:26:31.000Z","size":10,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-03T18:25:20.426Z","etag":null,"topics":["black","codeclimate","diff","gitlab","gitlab-ci","python"],"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/steinuil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-02-26T18:44:25.000Z","updated_at":"2024-02-27T12:15:42.000Z","dependencies_parsed_at":"2024-02-26T19:07:15.803Z","dependency_job_id":"9453fe0e-17ac-43ae-b58b-dd0df7703664","html_url":"https://github.com/steinuil/black-codeclimate","commit_stats":null,"previous_names":["steinuil/black-codeclimate"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/steinuil/black-codeclimate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinuil%2Fblack-codeclimate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinuil%2Fblack-codeclimate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinuil%2Fblack-codeclimate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinuil%2Fblack-codeclimate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/steinuil","download_url":"https://codeload.github.com/steinuil/black-codeclimate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/steinuil%2Fblack-codeclimate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33058965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-15T02:00:06.351Z","response_time":103,"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","codeclimate","diff","gitlab","gitlab-ci","python"],"created_at":"2025-10-28T10:11:21.490Z","updated_at":"2026-05-15T08:03:49.279Z","avatar_url":"https://github.com/steinuil.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `black-codeclimate`\n\n[![PyPI version](https://badge.fury.io/py/black-codeclimate.svg)](https://badge.fury.io/py/black-codeclimate)\n\nConvert the output of `black --diff` to a report conforming to the [Code Climate spec](https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md).\nIt is made to be used in GitLab CI to generate a [Code Quality report](https://docs.gitlab.com/ee/ci/testing/code_quality.html), which will show a nice widget in merge requests listing the file and the lines affected by the reformatting.\n\n`black-codeclimate` uses [unidiff](https://pypi.org/project/unidiff/) to parse a diff file and detect changes, and outputs a JSON array of Code Climate issue objects reporting the filename and line range of the change. In theory it could be used on any unified diff data, but I only tested it with `black --diff`'s output. Hit me up in the issues if you use it for anything else :)\n\n## Usage\n\nPipe the output of `black --diff` into `black-codeclimate`:\n\n```bash\nblack --diff src/ | black-codeclimate \u003e black_report.json\n```\n\nOr specify a file to use as input:\n\n```bash\nblack-codeclimate black.diff \u003e black_report.json\n```\n\nYou can also change the severity, description and check_name of the issues in the resulting report by specifying command line flags:\n\n```bash\nblack-codeclimate --severity blocker --description \"would reformat [black]\" --check-name \"black\" black.diff \u003e black_report.json\n```\n\nRun `black-codeclimate -h` to see a list of the available flags.\n\n## Adding it to GitLab\n\nAdd this step to your `.gitlab-ci.yml` file:\n\n```yaml\nlint:black:\n  stage: lint\n  before_script:\n    - # Install black and black-codeclimate...\n  script:\n    # --check fails the job if any inconsistent formatting is detected.\n    - black --diff --check src/ \u003e black.diff\n  after_script:\n    - black-codeclimate black.diff \u003e black_report.json\n  artifacts:\n    reports:\n      codequality: black_report.json\n    when: always\n```\n\nThis will upload the `black_report.json` as a GitLab Code Quality artifact. The lines that would be reformatted by `black` will show up as a [merge request widget](https://docs.gitlab.com/ee/ci/testing/code_quality.html#merge-request-widget).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteinuil%2Fblack-codeclimate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsteinuil%2Fblack-codeclimate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsteinuil%2Fblack-codeclimate/lists"}