Teach SonarQube isPluginApplicableToEntity.

Signed-off-by: Jeff Cook <jeff.cook@endurance.com>
This commit is contained in:
Jeff Cook
2021-04-07 23:22:30 +00:00
parent 5511d99465
commit 38726cd9a7
2 changed files with 4 additions and 0 deletions
@@ -15,3 +15,4 @@
*/
export * from './SonarQubeCard';
export { isSonarQubeAvailable as isPluginApplicableToEntity } 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] ?? '';
};