run prettier

Signed-off-by: Lucas De Souza <lucas.desouza@aa.com>
This commit is contained in:
Lucas De Souza
2022-11-22 10:19:45 -06:00
parent 250b6f04f8
commit b6e8b6a23f
3 changed files with 29 additions and 22 deletions
+6 -6
View File
@@ -212,12 +212,12 @@ catalog:
pullRequestBranchName: backstage-integration
rules:
- allow:
- Component
- API
- Resource
- System
- Domain
- Location
- Component
- API
- Resource
- System
- Domain
- Location
processors:
ldapOrg:
@@ -225,7 +225,12 @@ describe('DefaultCatalogRulesEnforcer', () => {
const enforcer = DefaultCatalogRulesEnforcer.fromConfig(
new ConfigReader({
catalog: {
rules: [{ allow: ['Component'], locations: [{ type: 'url', match: 'https://github.com/b/*' }] }],
rules: [
{
allow: ['Component'],
locations: [{ type: 'url', match: 'https://github.com/b/*' }],
},
],
},
}),
);
@@ -93,21 +93,23 @@ export class DefaultCatalogRulesEnforcer implements CatalogRulesEnforcer {
const rules = new Array<CatalogRule>();
if (config.has('catalog.rules')) {
const globalRules = config.getConfigArray('catalog.rules').map(ruleConfig => {
const rule: CatalogRule = {
allow: ruleConfig.getStringArray('allow').map(kind => ({ kind })),
};
const globalRules = config
.getConfigArray('catalog.rules')
.map(ruleConfig => {
const rule: CatalogRule = {
allow: ruleConfig.getStringArray('allow').map(kind => ({ kind })),
};
const locConf = ruleConfig.getOptionalConfigArray('locations');
if (locConf)
rule.locations = locConf.map(locationConfig => ({
match: locationConfig.getOptionalString('match'),
type: locationConfig.getString('type'),
target: locationConfig.getOptionalString('target')
}))
const locConf = ruleConfig.getOptionalConfigArray('locations');
if (locConf)
rule.locations = locConf.map(locationConfig => ({
match: locationConfig.getOptionalString('match'),
type: locationConfig.getString('type'),
target: locationConfig.getOptionalString('target'),
}));
return rule;
});
return rule;
});
rules.push(...globalRules);
} else {
rules.push(...DefaultCatalogRulesEnforcer.defaultRules);
@@ -135,7 +137,7 @@ export class DefaultCatalogRulesEnforcer implements CatalogRulesEnforcer {
return new DefaultCatalogRulesEnforcer(rules);
}
constructor(private readonly rules: CatalogRule[]) { }
constructor(private readonly rules: CatalogRule[]) {}
/**
* Checks whether a specific entity/location combination is allowed
@@ -157,7 +159,7 @@ export class DefaultCatalogRulesEnforcer implements CatalogRulesEnforcer {
private matchLocation(
location: LocationSpec,
matchers?: { target?: string; type: string, match?: string }[],
matchers?: { target?: string; type: string; match?: string }[],
): boolean {
if (!matchers) {
return true;