Implemented changes suggested by Deepsource.io
Signed-off-by: AaronvDiepen <aaronvdiepen@gmail.com>
This commit is contained in:
@@ -63,7 +63,7 @@ export default async (cmd: Command) => {
|
||||
const data = await readPluginData();
|
||||
const templateFiles = await diffTemplateFiles('default-plugin', data);
|
||||
await handleAllFiles(fileHandlers, templateFiles, promptFunc);
|
||||
await finalize();
|
||||
finalize();
|
||||
};
|
||||
|
||||
// Reads templating data from the existing plugin
|
||||
|
||||
@@ -226,7 +226,7 @@ export async function loadConfig(
|
||||
}
|
||||
}
|
||||
|
||||
const envConfigs = await readEnvConfig(process.env);
|
||||
const envConfigs = readEnvConfig(process.env);
|
||||
|
||||
const watchConfigFile = (watchProp: LoadConfigOptionsWatch) => {
|
||||
let watchedFiles = Array.from(loadedPaths);
|
||||
|
||||
@@ -185,7 +185,7 @@ describe('GheAuth AuthSessionStore', () => {
|
||||
|
||||
await expect(
|
||||
withLogCollector(async () => {
|
||||
await secondStore.setSession('no' as any);
|
||||
secondStore.setSession('no' as any);
|
||||
}),
|
||||
).resolves.toMatchObject({
|
||||
warn: [
|
||||
|
||||
@@ -30,7 +30,7 @@ describe('BitbucketRepositoryParser', () => {
|
||||
presence: 'optional',
|
||||
}),
|
||||
];
|
||||
const actual = await defaultRepositoryParser({
|
||||
const actual = defaultRepositoryParser({
|
||||
target: `${browseUrl}${path}`,
|
||||
});
|
||||
|
||||
|
||||
@@ -34,17 +34,16 @@ export type BitbucketRepositoryParser = (options: {
|
||||
logger: Logger;
|
||||
}) => AsyncIterable<CatalogProcessorResult>;
|
||||
|
||||
export const defaultRepositoryParser =
|
||||
async function* defaultRepositoryParser(options: {
|
||||
target: string;
|
||||
presence?: 'optional' | 'required';
|
||||
}) {
|
||||
yield processingResult.location({
|
||||
type: 'url',
|
||||
target: options.target,
|
||||
// Not all locations may actually exist, since the user defined them as a wildcard pattern.
|
||||
// Thus, we emit them as optional and let the downstream processor find them while not outputting
|
||||
// an error if it couldn't.
|
||||
presence: options.presence ?? 'optional',
|
||||
});
|
||||
};
|
||||
export function* defaultRepositoryParser(options: {
|
||||
target: string;
|
||||
presence?: 'optional' | 'required';
|
||||
}) {
|
||||
yield processingResult.location({
|
||||
type: 'url',
|
||||
target: options.target,
|
||||
// Not all locations may actually exist, since the user defined them as a wildcard pattern.
|
||||
// Thus, we emit them as optional and let the downstream processor find them while not outputting
|
||||
// an error if it couldn't.
|
||||
presence: options.presence ?? 'optional',
|
||||
});
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ describe('FactRetrieverEngine', () => {
|
||||
engine.schedule();
|
||||
const job: any = engine.getJob('test-factretriever');
|
||||
job.triggerScheduledJobNow();
|
||||
expect(job.cadence!!).toEqual(cadence);
|
||||
expect(job.cadence!).toEqual(cadence);
|
||||
expect(testFactRetriever.handler).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ entityFilter: testFactRetriever.entityFilter }),
|
||||
);
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ export const entityMetadataFactRetriever: FactRetriever = {
|
||||
return entities.items.map((entity: Entity) => {
|
||||
return {
|
||||
entity: {
|
||||
namespace: entity.metadata.namespace!!,
|
||||
namespace: entity.metadata.namespace!,
|
||||
kind: entity.kind,
|
||||
name: entity.metadata.name,
|
||||
},
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ export const entityOwnershipFactRetriever: FactRetriever = {
|
||||
return entities.items.map((entity: Entity) => {
|
||||
return {
|
||||
entity: {
|
||||
namespace: entity.metadata.namespace!!,
|
||||
namespace: entity.metadata.namespace!,
|
||||
kind: entity.kind,
|
||||
name: entity.metadata.name,
|
||||
},
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ export const techdocsFactRetriever: FactRetriever = {
|
||||
return entities.items.map((entity: Entity) => {
|
||||
return {
|
||||
entity: {
|
||||
namespace: entity.metadata.namespace!!,
|
||||
namespace: entity.metadata.namespace!,
|
||||
kind: entity.kind,
|
||||
name: entity.metadata.name,
|
||||
},
|
||||
|
||||
@@ -62,7 +62,7 @@ export class TechInsightsDatabase implements TechInsightsStore {
|
||||
return Object.values(groupedSchemas)
|
||||
.map(schemas => {
|
||||
const sorted = rsort(schemas.map(it => it.version));
|
||||
return schemas.find(it => it.version === sorted[0])!!;
|
||||
return schemas.find(it => it.version === sorted[0])!;
|
||||
})
|
||||
.map((it: RawDbFactSchemaRow) => ({
|
||||
...omit(it, 'schema'),
|
||||
@@ -188,7 +188,7 @@ export class TechInsightsDatabase implements TechInsightsStore {
|
||||
throw new Error(`No schema found for ${id}. `);
|
||||
}
|
||||
const sorted = rsort(existingSchemas.map(it => it.version));
|
||||
return existingSchemas.find(it => it.version === sorted[0])!!;
|
||||
return existingSchemas.find(it => it.version === sorted[0])!;
|
||||
}
|
||||
|
||||
private async deleteExpiredFactsByDate(
|
||||
|
||||
@@ -259,7 +259,7 @@ async function updateBackstageReleaseVersion(repo, type) {
|
||||
}
|
||||
} else if (type === 'patch') {
|
||||
if (preMode) {
|
||||
throw new Error(`Unexpected pre mode ${preMode} on branch ${branchName}`);
|
||||
throw new Error(`Unexpected pre mode ${preMode} on current branch`);
|
||||
}
|
||||
nextVersion = semver.inc(currentVersion, 'patch');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user