Run pre-commit hooks over existing codebase

Co-Authored-By: Ben Phelps <ben@phelps.io>
This commit is contained in:
shamoon
2023-10-17 23:26:55 -07:00
parent fa50bbad9c
commit 19c25713c4
387 changed files with 4785 additions and 4109 deletions

View File

@@ -12,14 +12,11 @@ export default function Component({ service }) {
const { data: prData, error: prError } = useWidgetAPI(widget, includePR ? "pr" : null);
const { data: pipelineData, error: pipelineError } = useWidgetAPI(widget, "pipeline");
if (
pipelineError ||
(includePR && (prError || prData?.errorCode !== undefined))
) {
if (pipelineError || (includePR && (prError || prData?.errorCode !== undefined))) {
let finalError = pipelineError ?? prError;
if (includePR && prData?.errorCode !== null) {
// pr call failed possibly with more specific message
finalError = { message: prData?.message ?? 'Error communicating with Azure API' }
finalError = { message: prData?.message ?? "Error communicating with Azure API" };
}
return <Container service={service} error={finalError} />;
}
@@ -42,24 +39,27 @@ export default function Component({ service }) {
) : (
<Block label="azuredevops.status" value={t(`azuredevops.${pipelineData.value[0].status.toString()}`)} />
)}
{includePR && <Block label="azuredevops.totalPrs" value={t("common.number", { value: prData.count })} />}
{includePR && <Block
{includePR && (
<Block
label="azuredevops.myPrs"
value={t("common.number", {
value: prData.value?.filter((item) => item.createdBy.uniqueName.toLowerCase() === userEmail.toLowerCase())
.length,
})}
/>}
{includePR && <Block
label="azuredevops.approved"
value={t("common.number", {
value: prData.value
?.filter((item) => item.createdBy.uniqueName.toLowerCase() === userEmail.toLowerCase())
.filter((item) => item.reviewers.some((reviewer) => [5,10].includes(reviewer.vote))).length
})}
/>}
/>
)}
{includePR && (
<Block
label="azuredevops.approved"
value={t("common.number", {
value: prData.value
?.filter((item) => item.createdBy.uniqueName.toLowerCase() === userEmail.toLowerCase())
.filter((item) => item.reviewers.some((reviewer) => [5, 10].includes(reviewer.vote))).length,
})}
/>
)}
</Container>
);
}

View File

@@ -6,11 +6,11 @@ const widget = {
mappings: {
pr: {
endpoint: "git/repositories/{repositoryId}/pullrequests"
endpoint: "git/repositories/{repositoryId}/pullrequests",
},
pipeline: {
endpoint: "build/Builds?branchName={branchName}&definitions={definitionId}"
endpoint: "build/Builds?branchName={branchName}&definitions={definitionId}",
},
},
};