Skip to main content

Convert black --diff output to a Code Climate report

Project description

black-codeclimate

Convert the output of black --diff to a report conforming to the Code Climate spec. It is aimed at GitLab CI, for which it can generate a Code Quality report.

Usage

Pipe the output of black --diff into black-codeclimate:

black --diff src/ | black-codeclimate > black_report.json

Or specify a file to use as input:

black-codeclimate black.diff > black_report.json

You can also change the severity, description and check_name of the issues in the resulting report by specifying command line flags:

black-codeclimate --severity blocker --description "Would reformat" --check-name "black" black.diff > black_report.json

To include in GitLab CI:

lint:black:
  stage: lint
  script:
    - # Install black and black-codeclimate...
    - black --diff src/ | black-codeclimate > black_report.json
  artifacts:
    reports:
      codequality: black_report.json
    when: always

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

black_codeclimate-1.0.1.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

black_codeclimate-1.0.1-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page