@backstage-community/plugin-sonarqube 0.7.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1891 -0
- package/README.md +64 -0
- package/config.d.ts +26 -0
- package/dist/esm/index-CwJaLZxM.esm.js +22 -0
- package/dist/esm/index-CwJaLZxM.esm.js.map +1 -0
- package/dist/esm/index-D3iMIkzq.esm.js +35 -0
- package/dist/esm/index-D3iMIkzq.esm.js.map +1 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.esm.js +489 -0
- package/dist/index.esm.js.map +1 -0
- package/package.json +79 -0
package/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# SonarQube Plugin
|
|
2
|
+
|
|
3
|
+
The SonarQube Plugin displays code statistics from [SonarCloud](https://sonarcloud.io) or [SonarQube](https://sonarqube.com).
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
1. Install the SonarQube Plugin:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# From your Backstage root directory
|
|
13
|
+
yarn --cwd packages/app add @backstage-community/plugin-sonarqube
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
2. Add the `EntitySonarQubeCard` to the EntityPage:
|
|
17
|
+
|
|
18
|
+
```diff
|
|
19
|
+
// packages/app/src/components/catalog/EntityPage.tsx
|
|
20
|
+
+ import { EntitySonarQubeCard } from '@backstage-community/plugin-sonarqube';
|
|
21
|
+
|
|
22
|
+
...
|
|
23
|
+
|
|
24
|
+
const overviewContent = (
|
|
25
|
+
<Grid container spacing={3} alignItems="stretch">
|
|
26
|
+
<Grid item md={6}>
|
|
27
|
+
<EntityAboutCard variant="gridItem" />
|
|
28
|
+
</Grid>
|
|
29
|
+
+ <Grid item md={6}>
|
|
30
|
+
+ <EntitySonarQubeCard variant="gridItem" />
|
|
31
|
+
+ </Grid>
|
|
32
|
+
</Grid>
|
|
33
|
+
);
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
3. Run the following commands in the root folder of the project to install and compile the changes.
|
|
37
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
yarn install
|
|
40
|
+
yarn tsc
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
4. Add the `sonarqube.org/project-key` annotation to the `catalog-info.yaml` file of the target repo for which code quality analysis is needed.
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
apiVersion: backstage.io/v1alpha1
|
|
47
|
+
kind: Component
|
|
48
|
+
metadata:
|
|
49
|
+
name: backstage
|
|
50
|
+
description: |
|
|
51
|
+
Backstage is an open-source developer portal that puts the developer experience first.
|
|
52
|
+
annotations:
|
|
53
|
+
sonarqube.org/project-key: YOUR_INSTANCE_NAME/YOUR_PROJECT_KEY
|
|
54
|
+
spec:
|
|
55
|
+
type: library
|
|
56
|
+
owner: CNCF
|
|
57
|
+
lifecycle: experimental
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`YOUR_INSTANCE_NAME/` is optional and will query the default instance if not provided.
|
|
61
|
+
|
|
62
|
+
## Links
|
|
63
|
+
|
|
64
|
+
- [Sonarqube Backend](../sonarqube-backend/README.md)
|
package/config.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 The Backstage Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export interface Config {
|
|
18
|
+
/** Optional configurations for the SonarQube plugin */
|
|
19
|
+
sonarqube?: {
|
|
20
|
+
/**
|
|
21
|
+
* The base url of the sonarqube installation. Defaults to https://sonarcloud.io.
|
|
22
|
+
* @visibility frontend
|
|
23
|
+
*/
|
|
24
|
+
baseUrl?: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { SonarQubeCard } from '../index.esm.js';
|
|
2
|
+
import 'cross-fetch';
|
|
3
|
+
import '@backstage-community/plugin-sonarqube-react';
|
|
4
|
+
import '@backstage/plugin-catalog-react';
|
|
5
|
+
import '@material-ui/core/Chip';
|
|
6
|
+
import '@material-ui/core/Grid';
|
|
7
|
+
import '@material-ui/core/styles';
|
|
8
|
+
import '@material-ui/icons/BugReport';
|
|
9
|
+
import '@material-ui/icons/Lock';
|
|
10
|
+
import '@material-ui/icons/LockOpen';
|
|
11
|
+
import '@material-ui/icons/Security';
|
|
12
|
+
import '@material-ui/icons/SentimentVeryDissatisfied';
|
|
13
|
+
import '@material-ui/icons/SentimentVerySatisfied';
|
|
14
|
+
import 'react';
|
|
15
|
+
import 'react-use/esm/useAsync';
|
|
16
|
+
import 'rc-progress';
|
|
17
|
+
import '@material-ui/core/Avatar';
|
|
18
|
+
import '@backstage/core-components';
|
|
19
|
+
import '@material-ui/core/Typography';
|
|
20
|
+
import '@backstage/core-plugin-api';
|
|
21
|
+
import 'luxon';
|
|
22
|
+
//# sourceMappingURL=index-CwJaLZxM.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CwJaLZxM.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Content, ContentHeader, SupportButton } from '@backstage/core-components';
|
|
2
|
+
import { useEntity, MissingAnnotationEmptyState } from '@backstage/plugin-catalog-react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { SonarQubeCard } from '../index.esm.js';
|
|
5
|
+
import { isSonarQubeAvailable, SONARQUBE_PROJECT_KEY_ANNOTATION } from '@backstage-community/plugin-sonarqube-react';
|
|
6
|
+
import 'cross-fetch';
|
|
7
|
+
import '@material-ui/core/Chip';
|
|
8
|
+
import '@material-ui/core/Grid';
|
|
9
|
+
import '@material-ui/core/styles';
|
|
10
|
+
import '@material-ui/icons/BugReport';
|
|
11
|
+
import '@material-ui/icons/Lock';
|
|
12
|
+
import '@material-ui/icons/LockOpen';
|
|
13
|
+
import '@material-ui/icons/Security';
|
|
14
|
+
import '@material-ui/icons/SentimentVeryDissatisfied';
|
|
15
|
+
import '@material-ui/icons/SentimentVerySatisfied';
|
|
16
|
+
import 'react-use/esm/useAsync';
|
|
17
|
+
import 'rc-progress';
|
|
18
|
+
import '@material-ui/core/Avatar';
|
|
19
|
+
import '@material-ui/core/Typography';
|
|
20
|
+
import '@backstage/core-plugin-api';
|
|
21
|
+
import 'luxon';
|
|
22
|
+
|
|
23
|
+
const SonarQubeContentPage = (props) => {
|
|
24
|
+
const { entity } = useEntity();
|
|
25
|
+
const { title, supportTitle } = props;
|
|
26
|
+
return isSonarQubeAvailable(entity) ? /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: title != null ? title : "SonarQube Dashboard" }, supportTitle && /* @__PURE__ */ React.createElement(SupportButton, null, supportTitle)), /* @__PURE__ */ React.createElement(SonarQubeCard, null)) : /* @__PURE__ */ React.createElement(
|
|
27
|
+
MissingAnnotationEmptyState,
|
|
28
|
+
{
|
|
29
|
+
annotation: SONARQUBE_PROJECT_KEY_ANNOTATION
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export { SonarQubeContentPage };
|
|
35
|
+
//# sourceMappingURL=index-D3iMIkzq.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-D3iMIkzq.esm.js","sources":["../../src/components/SonarQubeContentPage/SonarQubeContentPage.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Content,\n ContentHeader,\n SupportButton,\n} from '@backstage/core-components';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport React from 'react';\nimport { SonarQubeCard } from '../SonarQubeCard';\nimport {\n isSonarQubeAvailable,\n SONARQUBE_PROJECT_KEY_ANNOTATION,\n} from '@backstage-community/plugin-sonarqube-react';\n\n/** @public */\nexport type SonarQubeContentPageProps = {\n title?: string;\n supportTitle?: string;\n};\n\nexport const SonarQubeContentPage = (props: SonarQubeContentPageProps) => {\n const { entity } = useEntity();\n const { title, supportTitle } = props;\n\n return isSonarQubeAvailable(entity) ? (\n <Content>\n <ContentHeader title={title ?? 'SonarQube Dashboard'}>\n {supportTitle && <SupportButton>{supportTitle}</SupportButton>}\n </ContentHeader>\n <SonarQubeCard />\n </Content>\n ) : (\n <MissingAnnotationEmptyState\n annotation={SONARQUBE_PROJECT_KEY_ANNOTATION}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsCa,MAAA,oBAAA,GAAuB,CAAC,KAAqC,KAAA;AACxE,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAM,MAAA,EAAE,KAAO,EAAA,YAAA,EAAiB,GAAA,KAAA,CAAA;AAEhC,EAAA,OAAO,qBAAqB,MAAM,CAAA,uCAC/B,OACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,iBAAc,KAAO,EAAA,KAAA,IAAA,IAAA,GAAA,KAAA,GAAS,yBAC5B,YAAgB,oBAAA,KAAA,CAAA,aAAA,CAAC,qBAAe,YAAa,CAChD,mBACC,KAAA,CAAA,aAAA,CAAA,aAAA,EAAA,IAAc,CACjB,CAEA,mBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,2BAAA;AAAA,IAAA;AAAA,MACC,UAAY,EAAA,gCAAA;AAAA,KAAA;AAAA,GACd,CAAA;AAEJ;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SonarQubeApi, FindingSummary } from '@backstage-community/plugin-sonarqube-react';
|
|
3
|
+
import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
|
|
4
|
+
import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
|
|
5
|
+
import * as _backstage_catalog_model from '@backstage/catalog-model';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import React__default from 'react';
|
|
8
|
+
import * as _backstage_core_components from '@backstage/core-components';
|
|
9
|
+
import { InfoCardVariants } from '@backstage/core-components';
|
|
10
|
+
|
|
11
|
+
/** @public */
|
|
12
|
+
declare class SonarQubeClient implements SonarQubeApi {
|
|
13
|
+
discoveryApi: DiscoveryApi;
|
|
14
|
+
identityApi: IdentityApi;
|
|
15
|
+
constructor(options: {
|
|
16
|
+
discoveryApi: DiscoveryApi;
|
|
17
|
+
identityApi: IdentityApi;
|
|
18
|
+
});
|
|
19
|
+
private callApi;
|
|
20
|
+
getFindingSummary({ componentKey, projectInstance, }?: {
|
|
21
|
+
componentKey?: string;
|
|
22
|
+
projectInstance?: string;
|
|
23
|
+
}): Promise<FindingSummary | undefined>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** @public */
|
|
27
|
+
type DuplicationRating = {
|
|
28
|
+
greaterThan: number;
|
|
29
|
+
rating: '1.0' | '2.0' | '3.0' | '4.0' | '5.0';
|
|
30
|
+
};
|
|
31
|
+
/** @public */
|
|
32
|
+
declare const SonarQubeCard: (props: {
|
|
33
|
+
variant?: InfoCardVariants;
|
|
34
|
+
duplicationRatings?: DuplicationRating[];
|
|
35
|
+
}) => React__default.JSX.Element;
|
|
36
|
+
|
|
37
|
+
/** @public */
|
|
38
|
+
type SonarQubeContentPageProps = {
|
|
39
|
+
title?: string;
|
|
40
|
+
supportTitle?: string;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @public
|
|
45
|
+
*
|
|
46
|
+
* @deprecated use the same type from `@backstage-community/plugin-sonarqube-react` instead
|
|
47
|
+
*/
|
|
48
|
+
declare const isSonarQubeAvailable: (entity: _backstage_catalog_model.Entity) => boolean;
|
|
49
|
+
/**
|
|
50
|
+
* @public
|
|
51
|
+
*
|
|
52
|
+
* @deprecated use the same type from `@backstage-community/plugin-sonarqube-react` instead
|
|
53
|
+
*/
|
|
54
|
+
declare const SONARQUBE_PROJECT_KEY_ANNOTATION = "sonarqube.org/project-key";
|
|
55
|
+
|
|
56
|
+
/** @public */
|
|
57
|
+
declare const sonarQubePlugin: _backstage_core_plugin_api.BackstagePlugin<{}, {}, {}>;
|
|
58
|
+
/** @public */
|
|
59
|
+
declare const EntitySonarQubeCard: (props: {
|
|
60
|
+
variant?: _backstage_core_components.InfoCardVariants | undefined;
|
|
61
|
+
duplicationRatings?: DuplicationRating[] | undefined;
|
|
62
|
+
}) => React.JSX.Element;
|
|
63
|
+
/** @public */
|
|
64
|
+
declare const EntitySonarQubeContentPage: (props: SonarQubeContentPageProps) => React.JSX.Element;
|
|
65
|
+
|
|
66
|
+
export { type DuplicationRating, EntitySonarQubeCard, EntitySonarQubeContentPage, SONARQUBE_PROJECT_KEY_ANNOTATION, SonarQubeCard, SonarQubeClient, type SonarQubeContentPageProps, isSonarQubeAvailable, sonarQubePlugin };
|