Merge pull request #5245 from sjuxax/sonarqube-ispluginavail

Teach SonarQube `isPluginApplicableToEntity`.
This commit is contained in:
Ben Lambert
2021-04-08 15:52:46 +02:00
committed by GitHub
3 changed files with 9 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-sonarqube': patch
---
Export isSonarQubeAvailable.
@@ -15,3 +15,4 @@
*/
export * from './SonarQubeCard';
export { isSonarQubeAvailable } from './useProjectKey';
@@ -18,6 +18,9 @@ import { Entity } from '@backstage/catalog-model';
export const SONARQUBE_PROJECT_KEY_ANNOTATION = 'sonarqube.org/project-key';
export const isSonarQubeAvailable = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[SONARQUBE_PROJECT_KEY_ANNOTATION]);
export const useProjectKey = (entity: Entity) => {
return entity?.metadata.annotations?.[SONARQUBE_PROJECT_KEY_ANNOTATION] ?? '';
};