Skip to content

Commit

Permalink
feat: coc, license, pr template, contributing checks
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiejaoude committed Oct 2, 2024
1 parent bd7d560 commit 5e4ec2f
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 62 deletions.
22 changes: 0 additions & 22 deletions src/checks/codeOfConduct.js

This file was deleted.

26 changes: 26 additions & 0 deletions src/checks/codeOfConduct.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Community } from "@/models/github/community";
import { StatusCheck } from "@/types/checks";

export default function codeOfConduct(community: Community) {
const response: StatusCheck = {
title: "Code of Conduct",
status: "unknown",
description: "-",
extra: "-",
};

if (community.files?.code_of_conduct) {
response.status = "success";
response.description = "You have a CoC.";
response.extra = "No action required.";
}

if (!community.files || !community.files.code_of_conduct) {
response.status = "error";
response.description = "You do not have a CoC in your repo.";
response.extra =
"This is important for people to know your project and community is safe.";
}

return response;
}
16 changes: 10 additions & 6 deletions src/checks/contributing.js → src/checks/contributing.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
export default function contributing(communityMetrics) {
let response = {
id: "contributing",
href: "/repo/contributing",
import { Community } from "@/models/github/community";
import { StatusCheck } from "@/types/checks";

export default function contributing(community: Community) {
const response: StatusCheck = {
title: "Contributing",
status: "unknown",
description: "-",
extra: "-",
};

if (communityMetrics.files?.contributing) {
if (community.files?.contributing) {
response.status = "success";
response.description = "You have a contributing guide.";
response.extra = "No action required.";
}

if (!communityMetrics.files || !communityMetrics.files.contributing) {
if (!community.files || !community.files.contributing) {
response.status = "error";
response.description = "You do not have a contributing guide in your repo.";
response.extra =
Expand Down
8 changes: 4 additions & 4 deletions src/checks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ export default function checks(data: Data) {
// branches(data.branches),
// release(data.release),
readme(data.community),
// license(data.communityMetrics),
// contributing(data.communityMetrics),
// pullRequestTemplate(data.communityMetrics),
// codeOfConduct(data.communityMetrics),
license(data.community),
contributing(data.community),
pullRequestTemplate(data.community),
codeOfConduct(data.community),
// labels(data.labels),
];

Expand Down
21 changes: 0 additions & 21 deletions src/checks/license.js

This file was deleted.

25 changes: 25 additions & 0 deletions src/checks/license.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Community } from "@/models/github/community";
import { StatusCheck } from "@/types/checks";

export default function license(community: Community) {
const response: StatusCheck = {
title: "License",
status: "unknown",
description: "-",
extra: "-",
};

if (community.files?.license) {
response.status = "success";
response.description = "You have a license.";
response.extra = "No action required.";
}

if (!community.files || !community.files.license) {
response.status = "error";
response.description = "You do not have a license in your repo.";
response.extra = "This does not mean it is moe Open Source but less.";
}

return response;
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
export default function pullRequestTemplate(communityMetrics) {
let response = {
id: "pull-request-template",
href: "/repo/pull-request-template",
import { Community } from "@/models/github/community";
import { StatusCheck } from "@/types/checks";

export default function pullRequestTemplate(community: Community) {
const response: StatusCheck = {
title: "Pull Request template",
status: "unknown",
description: "-",
extra: "-",
};

if (communityMetrics.files?.pull_request_template) {
if (community.files?.pull_request_template) {
response.status = "success";
response.description = "You have a Pull Request template.";
response.extra = "No action required.";
}

if (
!communityMetrics.files ||
!communityMetrics.files.pull_request_template
) {
if (!community.files || !community.files.pull_request_template) {
response.status = "error";
response.description =
"You do not have a pull request template in your repo.";
Expand Down

0 comments on commit 5e4ec2f

Please sign in to comment.