From 836b30e61ca59846db6db2fe2e450f0f66660448 Mon Sep 17 00:00:00 2001 From: Magnus Persson Date: Tue, 22 Nov 2022 12:53:57 +0100 Subject: [PATCH] Update api-report.md Signed-off-by: Magnus Persson --- plugins/sonarqube-react/api-report.md | 71 +++++++++++++++++++ .../sonarqube-react/src/api/SonarQubeApi.ts | 6 ++ .../sonarqube-react/src/components/index.ts | 1 - .../src/components/isSonarQubeAvailable.ts | 2 +- .../src/hooks/useProjectInfo.test.ts | 6 +- .../src/hooks/useProjectInfo.ts | 11 ++- plugins/sonarqube/api-report.md | 4 +- plugins/sonarqube/src/components/index.ts | 4 ++ 8 files changed, 91 insertions(+), 14 deletions(-) create mode 100644 plugins/sonarqube-react/api-report.md diff --git a/plugins/sonarqube-react/api-report.md b/plugins/sonarqube-react/api-report.md new file mode 100644 index 0000000000..be84c45cce --- /dev/null +++ b/plugins/sonarqube-react/api-report.md @@ -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; +}; + +// @alpha (undocumented) +export const sonarQubeApiRef: ApiRef; + +// @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) +``` diff --git a/plugins/sonarqube-react/src/api/SonarQubeApi.ts b/plugins/sonarqube-react/src/api/SonarQubeApi.ts index 232ca535a9..ee6b1bb6a3 100644 --- a/plugins/sonarqube-react/src/api/SonarQubeApi.ts +++ b/plugins/sonarqube-react/src/api/SonarQubeApi.ts @@ -16,6 +16,7 @@ import { createApiRef } from '@backstage/core-plugin-api'; +/** @alpha */ export type MetricKey = // alert status | 'alert_status' @@ -42,15 +43,19 @@ export type MetricKey = // 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; @@ -60,6 +65,7 @@ export interface FindingSummary { getSecurityHotspotsUrl: () => string; } +/** @alpha */ export const sonarQubeApiRef = createApiRef({ id: 'plugin.sonarqube.service', }); diff --git a/plugins/sonarqube-react/src/components/index.ts b/plugins/sonarqube-react/src/components/index.ts index a000986306..44c63fe052 100644 --- a/plugins/sonarqube-react/src/components/index.ts +++ b/plugins/sonarqube-react/src/components/index.ts @@ -17,5 +17,4 @@ export { isSonarQubeAvailable, SONARQUBE_PROJECT_KEY_ANNOTATION, - SONARQUBE_PROJECT_INSTANCE_SEPARATOR, } from './isSonarQubeAvailable'; diff --git a/plugins/sonarqube-react/src/components/isSonarQubeAvailable.ts b/plugins/sonarqube-react/src/components/isSonarQubeAvailable.ts index b8504809c3..d538b700f3 100644 --- a/plugins/sonarqube-react/src/components/isSonarQubeAvailable.ts +++ b/plugins/sonarqube-react/src/components/isSonarQubeAvailable.ts @@ -16,8 +16,8 @@ import { Entity } from '@backstage/catalog-model'; +/** @public */ export const SONARQUBE_PROJECT_KEY_ANNOTATION = 'sonarqube.org/project-key'; -export const SONARQUBE_PROJECT_INSTANCE_SEPARATOR = '/'; /** @public */ export const isSonarQubeAvailable = (entity: Entity) => diff --git a/plugins/sonarqube-react/src/hooks/useProjectInfo.test.ts b/plugins/sonarqube-react/src/hooks/useProjectInfo.test.ts index 2babb4cd42..db5e1f9689 100644 --- a/plugins/sonarqube-react/src/hooks/useProjectInfo.test.ts +++ b/plugins/sonarqube-react/src/hooks/useProjectInfo.test.ts @@ -15,11 +15,9 @@ */ import { Entity } from '@backstage/catalog-model'; -import { - SONARQUBE_PROJECT_INSTANCE_SEPARATOR, - SONARQUBE_PROJECT_KEY_ANNOTATION, -} from '../components'; +import { SONARQUBE_PROJECT_KEY_ANNOTATION } from '../components'; import { useProjectInfo } from './useProjectInfo'; +import { SONARQUBE_PROJECT_INSTANCE_SEPARATOR } from './useProjectInfo'; const createDummyEntity = (sonarqubeAnnotationValue: string): Entity => { return { diff --git a/plugins/sonarqube-react/src/hooks/useProjectInfo.ts b/plugins/sonarqube-react/src/hooks/useProjectInfo.ts index 61c8baed98..119e568e46 100644 --- a/plugins/sonarqube-react/src/hooks/useProjectInfo.ts +++ b/plugins/sonarqube-react/src/hooks/useProjectInfo.ts @@ -15,10 +15,9 @@ */ import { Entity } from '@backstage/catalog-model'; -import { - SONARQUBE_PROJECT_INSTANCE_SEPARATOR, - SONARQUBE_PROJECT_KEY_ANNOTATION, -} from '../components'; +import { SONARQUBE_PROJECT_KEY_ANNOTATION } from '../components'; + +export const SONARQUBE_PROJECT_INSTANCE_SEPARATOR = '/'; /** * @@ -27,8 +26,8 @@ import { * If part or all info are not found, they will default to undefined * * @alpha - * @param entity entity to find the sonarqube information from. - * @return a ProjectInfo properly populated. + * @param entity - entity to find the sonarqube information from. + * @returns a ProjectInfo properly populated. */ export const useProjectInfo = ( entity: Entity, diff --git a/plugins/sonarqube/api-report.md b/plugins/sonarqube/api-report.md index 2edf80618e..31e98a0f4a 100644 --- a/plugins/sonarqube/api-report.md +++ b/plugins/sonarqube/api-report.md @@ -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) diff --git a/plugins/sonarqube/src/components/index.ts b/plugins/sonarqube/src/components/index.ts index 08af5591fd..252c12c5db 100644 --- a/plugins/sonarqube/src/components/index.ts +++ b/plugins/sonarqube/src/components/index.ts @@ -24,11 +24,15 @@ export type { DuplicationRating } from './SonarQubeCard'; export type { SonarQubeContentPageProps } from './SonarQubeContentPage'; /** + * @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 =