Merge pull request #14314 from magnusp/sonarqube-public-api
Expose SonarQube API and helpers
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
---
|
||||
'@backstage/plugin-sonarqube': minor
|
||||
'@backstage/plugin-sonarqube-react': minor
|
||||
---
|
||||
|
||||
Parts of plugin-sonarqube have been moved into a new plugin-sonarqube-react package. Additionally some types that were
|
||||
previously internal to plugin-sonarqube have been made public and will allow access for third-parties. As the sonarqube
|
||||
plugin has not yet reached 1.0 breaking changes are expected in the future. As such exports of plugin-sonarqube-react
|
||||
require importing via the `/alpha` entrypoint:
|
||||
|
||||
```ts
|
||||
import { sonarQubeApiRef } from '@backstage/plugin-sonarqube-react/alpha';
|
||||
|
||||
const sonarQubeApi = useApi(sonarQubeApiRef);
|
||||
```
|
||||
|
||||
Moved from plugin-sonarqube to plugin-sonarqube-react:
|
||||
|
||||
- isSonarQubeAvailable
|
||||
- SONARQUBE_PROJECT_KEY_ANNOTATION
|
||||
|
||||
Exports that been introduced to plugin-sonarqube-react are documented in the [API report](https://github.com/backstage/backstage/blob/master/plugins/sonarqube-react/api-report.md).
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
|
||||
@@ -0,0 +1,71 @@
|
||||
## API Report File for "@backstage/plugin-sonarqube-react"
|
||||
|
||||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
||||
|
||||
```ts
|
||||
import { ApiRef } from '@backstage/core-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
|
||||
// @alpha (undocumented)
|
||||
export interface FindingSummary {
|
||||
// (undocumented)
|
||||
getComponentMeasuresUrl: SonarUrlProcessorFunc;
|
||||
// (undocumented)
|
||||
getIssuesUrl: SonarUrlProcessorFunc;
|
||||
// (undocumented)
|
||||
getSecurityHotspotsUrl: () => string;
|
||||
// (undocumented)
|
||||
lastAnalysis: string;
|
||||
// (undocumented)
|
||||
metrics: Metrics;
|
||||
// (undocumented)
|
||||
projectUrl: string;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export const isSonarQubeAvailable: (entity: Entity) => boolean;
|
||||
|
||||
// @alpha (undocumented)
|
||||
export type MetricKey =
|
||||
| 'alert_status'
|
||||
| 'bugs'
|
||||
| 'reliability_rating'
|
||||
| 'vulnerabilities'
|
||||
| 'security_rating'
|
||||
| 'code_smells'
|
||||
| 'sqale_rating'
|
||||
| 'security_hotspots_reviewed'
|
||||
| 'security_review_rating'
|
||||
| 'coverage'
|
||||
| 'duplicated_lines_density';
|
||||
|
||||
// @alpha
|
||||
export type Metrics = {
|
||||
[key in MetricKey]: string | undefined;
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export const SONARQUBE_PROJECT_KEY_ANNOTATION = 'sonarqube.org/project-key';
|
||||
|
||||
// @alpha (undocumented)
|
||||
export type SonarQubeApi = {
|
||||
getFindingSummary(options: {
|
||||
componentKey?: string;
|
||||
projectInstance?: string;
|
||||
}): Promise<FindingSummary | undefined>;
|
||||
};
|
||||
|
||||
// @alpha (undocumented)
|
||||
export const sonarQubeApiRef: ApiRef<SonarQubeApi>;
|
||||
|
||||
// @alpha (undocumented)
|
||||
export type SonarUrlProcessorFunc = (identifier: string) => string;
|
||||
|
||||
// @alpha
|
||||
export const useProjectInfo: (entity: Entity) => {
|
||||
projectInstance: string | undefined;
|
||||
projectKey: string | undefined;
|
||||
};
|
||||
|
||||
// (No @packageDocumentation comment for this package)
|
||||
```
|
||||
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "@backstage/plugin-sonarqube-react",
|
||||
"version": "0.0.0",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"license": "Apache-2.0",
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"main": "dist/index.esm.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"alphaTypes": "dist/index.alpha.d.ts"
|
||||
},
|
||||
"backstage": {
|
||||
"role": "web-library"
|
||||
},
|
||||
"homepage": "https://backstage.io",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/backstage/backstage",
|
||||
"directory": "plugins/sonarqube-react"
|
||||
},
|
||||
"keywords": [
|
||||
"backstage"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "backstage-cli package build --experimental-type-build",
|
||||
"lint": "backstage-cli package lint",
|
||||
"test": "backstage-cli package test",
|
||||
"prepack": "backstage-cli package prepack",
|
||||
"postpack": "backstage-cli package postpack",
|
||||
"clean": "backstage-cli package clean",
|
||||
"start": "backstage-cli package start"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/catalog-model": "workspace:^",
|
||||
"@backstage/core-plugin-api": "workspace:^"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^16.13.1 || ^17.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@backstage/cli": "workspace:^"
|
||||
},
|
||||
"files": [
|
||||
"dist",
|
||||
"alpha"
|
||||
]
|
||||
}
|
||||
+36
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020 The Backstage Authors
|
||||
* Copyright 2022 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -14,16 +14,48 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { MetricKey, SonarUrlProcessorFunc } from './types';
|
||||
import { createApiRef } from '@backstage/core-plugin-api';
|
||||
|
||||
/** @alpha */
|
||||
export type MetricKey =
|
||||
// alert status
|
||||
| 'alert_status'
|
||||
|
||||
// bugs and rating (-> reliability)
|
||||
| 'bugs'
|
||||
| 'reliability_rating'
|
||||
|
||||
// vulnerabilities and rating (-> security)
|
||||
| 'vulnerabilities'
|
||||
| 'security_rating'
|
||||
|
||||
// code smells and rating (-> maintainability)
|
||||
| 'code_smells'
|
||||
| 'sqale_rating'
|
||||
|
||||
// security hotspots
|
||||
| 'security_hotspots_reviewed'
|
||||
| 'security_review_rating'
|
||||
|
||||
// coverage
|
||||
| 'coverage'
|
||||
|
||||
// duplicated lines
|
||||
| 'duplicated_lines_density';
|
||||
|
||||
/** @alpha */
|
||||
export type SonarUrlProcessorFunc = (identifier: string) => string;
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
*
|
||||
* Define a type to make sure that all metrics are used
|
||||
*/
|
||||
export type Metrics = {
|
||||
[key in MetricKey]: string | undefined;
|
||||
};
|
||||
|
||||
/** @alpha */
|
||||
export interface FindingSummary {
|
||||
lastAnalysis: string;
|
||||
metrics: Metrics;
|
||||
@@ -33,10 +65,12 @@ export interface FindingSummary {
|
||||
getSecurityHotspotsUrl: () => string;
|
||||
}
|
||||
|
||||
/** @alpha */
|
||||
export const sonarQubeApiRef = createApiRef<SonarQubeApi>({
|
||||
id: 'plugin.sonarqube.service',
|
||||
});
|
||||
|
||||
/** @alpha */
|
||||
export type SonarQubeApi = {
|
||||
getFindingSummary(options: {
|
||||
componentKey?: string;
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2022 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { sonarQubeApiRef } from './SonarQubeApi';
|
||||
export type {
|
||||
Metrics,
|
||||
MetricKey,
|
||||
SonarQubeApi,
|
||||
FindingSummary,
|
||||
SonarUrlProcessorFunc,
|
||||
} from './SonarQubeApi';
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2022 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export {
|
||||
isSonarQubeAvailable,
|
||||
SONARQUBE_PROJECT_KEY_ANNOTATION,
|
||||
} from './isSonarQubeAvailable';
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright 2022 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import {
|
||||
isSonarQubeAvailable,
|
||||
SONARQUBE_PROJECT_KEY_ANNOTATION,
|
||||
} from './isSonarQubeAvailable';
|
||||
|
||||
const createDummyEntity = (sonarqubeAnnotationValue: string): Entity => {
|
||||
return {
|
||||
apiVersion: '',
|
||||
kind: '',
|
||||
metadata: {
|
||||
name: 'dummy',
|
||||
annotations: {
|
||||
[SONARQUBE_PROJECT_KEY_ANNOTATION]: sonarqubeAnnotationValue,
|
||||
},
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
describe('isSonarQubeAvailable', () => {
|
||||
it('returns true if sonarqube annotation defined', () => {
|
||||
const entity = createDummyEntity('dummy');
|
||||
expect(isSonarQubeAvailable(entity)).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false if sonarqube annotation empty', () => {
|
||||
const entity = createDummyEntity('');
|
||||
expect(isSonarQubeAvailable(entity)).toBe(false);
|
||||
});
|
||||
|
||||
it('returns false if sonarqube annotation not defined', () => {
|
||||
const entity = {
|
||||
apiVersion: '',
|
||||
kind: '',
|
||||
metadata: {
|
||||
name: 'dummy',
|
||||
annotations: {},
|
||||
},
|
||||
};
|
||||
expect(isSonarQubeAvailable(entity)).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2022 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
|
||||
/** @public */
|
||||
export const SONARQUBE_PROJECT_KEY_ANNOTATION = 'sonarqube.org/project-key';
|
||||
|
||||
/** @public */
|
||||
export const isSonarQubeAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[SONARQUBE_PROJECT_KEY_ANNOTATION]);
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright 2022 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { useProjectInfo } from './useProjectInfo';
|
||||
+4
-30
@@ -13,13 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {
|
||||
isSonarQubeAvailable,
|
||||
SONARQUBE_PROJECT_INSTANCE_SEPARATOR,
|
||||
SONARQUBE_PROJECT_KEY_ANNOTATION,
|
||||
useProjectInfo,
|
||||
} from './useProjectKey';
|
||||
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { SONARQUBE_PROJECT_KEY_ANNOTATION } from '../components';
|
||||
import { useProjectInfo } from './useProjectInfo';
|
||||
import { SONARQUBE_PROJECT_INSTANCE_SEPARATOR } from './useProjectInfo';
|
||||
|
||||
const createDummyEntity = (sonarqubeAnnotationValue: string): Entity => {
|
||||
return {
|
||||
@@ -34,30 +32,6 @@ const createDummyEntity = (sonarqubeAnnotationValue: string): Entity => {
|
||||
};
|
||||
};
|
||||
|
||||
describe('isSonarQubeAvailable', () => {
|
||||
it('returns true if sonarqube annotation defined', () => {
|
||||
const entity = createDummyEntity('dummy');
|
||||
expect(isSonarQubeAvailable(entity)).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false if sonarqube annotation empty', () => {
|
||||
const entity = createDummyEntity('');
|
||||
expect(isSonarQubeAvailable(entity)).toBe(false);
|
||||
});
|
||||
|
||||
it('returns false if sonarqube annotation not defined', () => {
|
||||
const entity = {
|
||||
apiVersion: '',
|
||||
kind: '',
|
||||
metadata: {
|
||||
name: 'dummy',
|
||||
annotations: {},
|
||||
},
|
||||
};
|
||||
expect(isSonarQubeAvailable(entity)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('useProjectInfo', () => {
|
||||
const DUMMY_INSTANCE = 'dummyInstance';
|
||||
const DUMMY_KEY = 'dummyKey';
|
||||
+6
-9
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020 The Backstage Authors
|
||||
* Copyright 2022 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,22 +15,19 @@
|
||||
*/
|
||||
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { SONARQUBE_PROJECT_KEY_ANNOTATION } from '../components';
|
||||
|
||||
/** @public */
|
||||
export const SONARQUBE_PROJECT_KEY_ANNOTATION = 'sonarqube.org/project-key';
|
||||
export const SONARQUBE_PROJECT_INSTANCE_SEPARATOR = '/';
|
||||
|
||||
/** @public */
|
||||
export const isSonarQubeAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[SONARQUBE_PROJECT_KEY_ANNOTATION]);
|
||||
|
||||
/**
|
||||
*
|
||||
* Try to parse sonarqube information from an entity.
|
||||
*
|
||||
* If part or all info are not found, they will default to undefined
|
||||
*
|
||||
* @param entity entity to find the sonarqube information from.
|
||||
* @return a ProjectInfo properly populated.
|
||||
* @alpha
|
||||
* @param entity - entity to find the sonarqube information from.
|
||||
* @returns a ProjectInfo properly populated.
|
||||
*/
|
||||
export const useProjectInfo = (
|
||||
entity: Entity,
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2022 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export * from './api';
|
||||
export * from './components';
|
||||
export * from './hooks';
|
||||
@@ -26,10 +26,10 @@ export const EntitySonarQubeContentPage: (
|
||||
props: SonarQubeContentPageProps,
|
||||
) => JSX.Element;
|
||||
|
||||
// @public (undocumented)
|
||||
// @public @deprecated (undocumented)
|
||||
export const isSonarQubeAvailable: (entity: Entity) => boolean;
|
||||
|
||||
// @public (undocumented)
|
||||
// @public @deprecated (undocumented)
|
||||
export const SONARQUBE_PROJECT_KEY_ANNOTATION = 'sonarqube.org/project-key';
|
||||
|
||||
// @public (undocumented)
|
||||
|
||||
@@ -19,9 +19,13 @@ import { createDevApp, EntityGridItem } from '@backstage/dev-utils';
|
||||
import { Grid } from '@material-ui/core';
|
||||
import React from 'react';
|
||||
import { EntitySonarQubeCard, sonarQubePlugin } from '../src';
|
||||
import { FindingSummary, SonarQubeApi, sonarQubeApiRef } from '../src/api';
|
||||
import { SONARQUBE_PROJECT_KEY_ANNOTATION } from '../src/components/useProjectKey';
|
||||
import { Content, Header, Page } from '@backstage/core-components';
|
||||
import {
|
||||
FindingSummary,
|
||||
SONARQUBE_PROJECT_KEY_ANNOTATION,
|
||||
SonarQubeApi,
|
||||
sonarQubeApiRef,
|
||||
} from '@backstage/plugin-sonarqube-react';
|
||||
|
||||
const entity = (name?: string) =>
|
||||
({
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
"@backstage/core-components": "workspace:^",
|
||||
"@backstage/core-plugin-api": "workspace:^",
|
||||
"@backstage/plugin-catalog-react": "workspace:^",
|
||||
"@backstage/plugin-sonarqube-react": "workspace:^",
|
||||
"@backstage/theme": "workspace:^",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
|
||||
@@ -17,10 +17,11 @@
|
||||
import { setupRequestMockHandlers } from '@backstage/test-utils';
|
||||
import { rest } from 'msw';
|
||||
import { setupServer } from 'msw/node';
|
||||
import { FindingSummary, SonarQubeClient } from './index';
|
||||
import { SonarQubeClient } from './index';
|
||||
import { InstanceUrlWrapper, FindingsWrapper } from './types';
|
||||
import { UrlPatternDiscovery } from '@backstage/core-app-api';
|
||||
import { IdentityApi } from '@backstage/core-plugin-api';
|
||||
import { FindingSummary } from '@backstage/plugin-sonarqube-react';
|
||||
|
||||
const server = setupServer();
|
||||
|
||||
|
||||
@@ -15,7 +15,11 @@
|
||||
*/
|
||||
|
||||
import fetch from 'cross-fetch';
|
||||
import { FindingSummary, Metrics, SonarQubeApi } from './SonarQubeApi';
|
||||
import {
|
||||
FindingSummary,
|
||||
Metrics,
|
||||
SonarQubeApi,
|
||||
} from '@backstage/plugin-sonarqube-react';
|
||||
import { InstanceUrlWrapper, FindingsWrapper } from './types';
|
||||
import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
|
||||
|
||||
|
||||
@@ -14,6 +14,4 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export type { Metrics, FindingSummary, SonarQubeApi } from './SonarQubeApi';
|
||||
export { sonarQubeApiRef } from './SonarQubeApi';
|
||||
export { SonarQubeClient } from './SonarQubeClient';
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { MetricKey as NonDeprecatedMetricKey } from '@backstage/plugin-sonarqube-react';
|
||||
import { SonarUrlProcessorFunc as NonDeprecatedSonarUrlProcessorFunc } from '@backstage/plugin-sonarqube-react';
|
||||
|
||||
export interface InstanceUrlWrapper {
|
||||
instanceUrl: string;
|
||||
}
|
||||
@@ -23,35 +26,17 @@ export interface FindingsWrapper {
|
||||
measures: Measure[];
|
||||
}
|
||||
|
||||
export type MetricKey =
|
||||
// alert status
|
||||
| 'alert_status'
|
||||
|
||||
// bugs and rating (-> reliability)
|
||||
| 'bugs'
|
||||
| 'reliability_rating'
|
||||
|
||||
// vulnerabilities and rating (-> security)
|
||||
| 'vulnerabilities'
|
||||
| 'security_rating'
|
||||
|
||||
// code smells and rating (-> maintainability)
|
||||
| 'code_smells'
|
||||
| 'sqale_rating'
|
||||
|
||||
// security hotspots
|
||||
| 'security_hotspots_reviewed'
|
||||
| 'security_review_rating'
|
||||
|
||||
// coverage
|
||||
| 'coverage'
|
||||
|
||||
// duplicated lines
|
||||
| 'duplicated_lines_density';
|
||||
/**
|
||||
* @deprecated use the same type from `@backstage/plugin-sonarqube-react` instead
|
||||
*/
|
||||
export type MetricKey = NonDeprecatedMetricKey;
|
||||
|
||||
export interface Measure {
|
||||
metric: MetricKey;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export type SonarUrlProcessorFunc = (identifier: string) => string;
|
||||
/**
|
||||
* @deprecated use the same type from `@backstage/plugin-sonarqube-react` instead
|
||||
*/
|
||||
export type SonarUrlProcessorFunc = NonDeprecatedSonarUrlProcessorFunc;
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
*/
|
||||
|
||||
import { useEntity } from '@backstage/plugin-catalog-react';
|
||||
import {
|
||||
SONARQUBE_PROJECT_KEY_ANNOTATION,
|
||||
sonarQubeApiRef,
|
||||
useProjectInfo,
|
||||
} from '@backstage/plugin-sonarqube-react';
|
||||
import { Chip, Grid } from '@material-ui/core';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import BugReport from '@material-ui/icons/BugReport';
|
||||
@@ -23,11 +28,6 @@ import Security from '@material-ui/icons/Security';
|
||||
import SentimentVeryDissatisfied from '@material-ui/icons/SentimentVeryDissatisfied';
|
||||
import React, { useMemo } from 'react';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
import { sonarQubeApiRef } from '../../api';
|
||||
import {
|
||||
SONARQUBE_PROJECT_KEY_ANNOTATION,
|
||||
useProjectInfo,
|
||||
} from '../useProjectKey';
|
||||
import { Percentage } from './Percentage';
|
||||
import { Rating } from './Rating';
|
||||
import { RatingCard } from './RatingCard';
|
||||
|
||||
@@ -22,8 +22,9 @@ import React from 'react';
|
||||
import {
|
||||
isSonarQubeAvailable,
|
||||
SONARQUBE_PROJECT_KEY_ANNOTATION,
|
||||
} from '../useProjectKey';
|
||||
import { SonarQubeApi, sonarQubeApiRef } from '../../api';
|
||||
SonarQubeApi,
|
||||
sonarQubeApiRef,
|
||||
} from '@backstage/plugin-sonarqube-react';
|
||||
|
||||
const Providers = ({
|
||||
annotation,
|
||||
|
||||
@@ -22,11 +22,11 @@ import {
|
||||
import { MissingAnnotationEmptyState } from '@backstage/core-components';
|
||||
import { useEntity } from '@backstage/plugin-catalog-react';
|
||||
import React from 'react';
|
||||
import { SonarQubeCard } from '../SonarQubeCard';
|
||||
import {
|
||||
isSonarQubeAvailable,
|
||||
SONARQUBE_PROJECT_KEY_ANNOTATION,
|
||||
} from '../useProjectKey';
|
||||
import { SonarQubeCard } from '../SonarQubeCard';
|
||||
} from '@backstage/plugin-sonarqube-react';
|
||||
|
||||
/** @public */
|
||||
export type SonarQubeContentPageProps = {
|
||||
|
||||
@@ -14,10 +14,26 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
isSonarQubeAvailable as NonDeprecatedIsSonarQubeAvailable,
|
||||
SONARQUBE_PROJECT_KEY_ANNOTATION as NON_DEPRECATED_SONARQUBE_PROJECT_KEY_ANNOTATION,
|
||||
} from '@backstage/plugin-sonarqube-react';
|
||||
|
||||
export { SonarQubeCard } from './SonarQubeCard';
|
||||
export type { DuplicationRating } from './SonarQubeCard';
|
||||
export type { SonarQubeContentPageProps } from './SonarQubeContentPage';
|
||||
export {
|
||||
isSonarQubeAvailable,
|
||||
SONARQUBE_PROJECT_KEY_ANNOTATION,
|
||||
} from './useProjectKey';
|
||||
|
||||
/**
|
||||
* @public
|
||||
*
|
||||
* @deprecated use the same type from `@backstage/plugin-sonarqube-react` instead
|
||||
*/
|
||||
export const isSonarQubeAvailable = NonDeprecatedIsSonarQubeAvailable;
|
||||
|
||||
/**
|
||||
* @public
|
||||
*
|
||||
* @deprecated use the same type from `@backstage/plugin-sonarqube-react` instead
|
||||
*/
|
||||
export const SONARQUBE_PROJECT_KEY_ANNOTATION =
|
||||
NON_DEPRECATED_SONARQUBE_PROJECT_KEY_ANNOTATION;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { sonarQubeApiRef, SonarQubeClient } from './api';
|
||||
import { SonarQubeClient } from './api';
|
||||
import {
|
||||
createApiFactory,
|
||||
createComponentExtension,
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
discoveryApiRef,
|
||||
identityApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { sonarQubeApiRef } from '@backstage/plugin-sonarqube-react';
|
||||
|
||||
/** @public */
|
||||
export const sonarQubePlugin = createPlugin({
|
||||
|
||||
@@ -7786,6 +7786,18 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@backstage/plugin-sonarqube-react@workspace:^, @backstage/plugin-sonarqube-react@workspace:plugins/sonarqube-react":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@backstage/plugin-sonarqube-react@workspace:plugins/sonarqube-react"
|
||||
dependencies:
|
||||
"@backstage/catalog-model": "workspace:^"
|
||||
"@backstage/cli": "workspace:^"
|
||||
"@backstage/core-plugin-api": "workspace:^"
|
||||
peerDependencies:
|
||||
react: ^16.13.1 || ^17.0.0
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@backstage/plugin-sonarqube@workspace:plugins/sonarqube":
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@backstage/plugin-sonarqube@workspace:plugins/sonarqube"
|
||||
@@ -7797,6 +7809,7 @@ __metadata:
|
||||
"@backstage/core-plugin-api": "workspace:^"
|
||||
"@backstage/dev-utils": "workspace:^"
|
||||
"@backstage/plugin-catalog-react": "workspace:^"
|
||||
"@backstage/plugin-sonarqube-react": "workspace:^"
|
||||
"@backstage/test-utils": "workspace:^"
|
||||
"@backstage/theme": "workspace:^"
|
||||
"@material-ui/core": ^4.12.2
|
||||
|
||||
Reference in New Issue
Block a user