Files
backstage/plugins/code-climate
dependabot[bot] a422d7ce5e chore(deps): bump @testing-library/react from 11.2.6 to 12.1.3
Bumps [@testing-library/react](https://github.com/testing-library/react-testing-library) from 11.2.6 to 12.1.3.
- [Release notes](https://github.com/testing-library/react-testing-library/releases)
- [Changelog](https://github.com/testing-library/react-testing-library/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testing-library/react-testing-library/compare/v11.2.6...v12.1.3)

---
updated-dependencies:
- dependency-name: "@testing-library/react"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-10 14:07:33 +01:00
..
2022-03-10 11:30:23 +00:00

Code Climate Plugin

The Code Climate Plugin displays a few stats from the quality section from Code Climate.

Code Climate Card

Getting Started

  1. Install the Code Climate Plugin:
# From your Backstage root directory
cd packages/app
yarn add @backstage/plugin-code-climate
  1. Add the EntityCodeClimateCard to the EntityPage:
// packages/app/src/components/catalog/EntityPage.tsx

import { EntityCodeClimateCard } from '@backstage/plugin-code-climate';

const overviewContent = (
  <Grid container spacing={3} alignItems="stretch">
    // ...
    <Grid item>
      <EntityCodeClimateCard />
    </Grid>
    // ...
  </Grid>
);
  1. Add the proxy config:
# app-config.yaml

proxy:
  '/codeclimate/api':
    target: https://api.codeclimate.com/v1
    headers:
      Authorization: Token token=${CODECLIMATE_TOKEN}
  1. Create a new API access token (https://codeclimate.com/profile/tokens) and provide CODECLIMATE_TOKEN as an env variable.

  2. Add the codeclimate.com/repo-id annotation to your catalog-info.yaml file:

apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
  name: backstage
  description: |
    Backstage is an open-source developer portal that puts the developer experience first.
  annotations:
    codeclimate.com/repo-id: YOUR_REPO_ID
spec:
  type: library
  owner: CNCF
  lifecycle: experimental

Demo Mode

The plugin provides a MockAPI that always returns dummy data instead of talking to the Code Climate backend. You can add it by overriding the codeClimateApiRef:

// packages/app/src/apis.ts

import { createApiFactory } from '@backstage/core-plugin-api';
import {
  MockCodeClimateApi,
  codeClimateApiRef,
} from '@backstage/plugin-code-climate';

export const apis = [
  // ...

  createApiFactory(codeClimateApiRef, new MockCodeClimateApi()),
];