Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
refactor: remove unused exports and functions
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4007 committed Nov 26, 2023
1 parent 8277400 commit 55c68b7
Show file tree
Hide file tree
Showing 18 changed files with 100 additions and 835 deletions.
7 changes: 1 addition & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"@sinclair/typebox": "^0.31.22",
"@supabase/supabase-js": "^2.4.0",
"@types/ms": "^0.7.31",
"@types/parse5": "^7.0.0",
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"@uniswap/permit2-sdk": "^1.2.0",
Expand All @@ -59,7 +58,6 @@
"node-html-parser": "^6.1.5",
"nodemon": "^2.0.19",
"openai": "^4.2.0",
"parse5": "^7.1.2",
"prettier": "^2.7.1",
"probot": "^12.2.4",
"tsx": "^3.12.7",
Expand All @@ -68,7 +66,6 @@
"devDependencies": {
"@types/dotenv": "^8.2.0",
"@types/eslint": "^8.40.2",
"@types/jest": "^29.5.5",
"@types/jsdom": "^21.1.4",
"@types/libsodium-wrappers": "^0.7.10",
"@types/lodash": "^4.14.197",
Expand All @@ -78,9 +75,7 @@
"eslint": "^8.43.0",
"jest": "^29.6.2",
"knip": "^2.33.4",
"octokit": "^3.1.1",
"rimraf": "3.0.2",
"smee-client": "^1.2.3",
"source-map-support": "^0.5.21",
"ts-jest": "^29.1.1",
"typescript": "^4.9.5"
Expand Down Expand Up @@ -108,4 +103,4 @@
"ext": "ts",
"exec": "yarn start"
}
}
}
2 changes: 1 addition & 1 deletion src/adapters/supabase/helpers/pretty-logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ interface Metadata {
[key: string]: any;
}

export enum Colors {
enum Colors {
reset = "\x1b[0m",
bright = "\x1b[1m",
dim = "\x1b[2m",
Expand Down
49 changes: 2 additions & 47 deletions src/adapters/supabase/helpers/tables/locations.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { SupabaseClient } from "@supabase/supabase-js";
import { Super } from "./super";
import { Database } from "../../types/database";
import { Context as ProbotContext } from "probot";
// import { Database } from "../../types/database";

// currently trying to save all of the location metadata of the event.
// seems that focusing on the IssueComments will provide the most value

export type LocationsRow = Database["public"]["Tables"]["logs"]["Row"];
// type LocationsRow = Database["public"]["Tables"]["logs"]["Row"];
export class Locations extends Super {
locationResponse: LocationResponse | undefined;

Expand All @@ -30,50 +29,6 @@ export class Locations extends Super {
if (error) throw this.runtime.logger.error("Error getting location data", new Error(error.message));
return locationData;
}

public async getLocationsMetaData(context: ProbotContext, issueCommentId: string) {
const graphQlQuery = `
query {
node(id: "${issueCommentId}") {
... on IssueComment {
id
author {
login
... on User {
id
}
}
issue {
id
number
repository {
id
name
owner {
... on Organization {
id
login
}
}
}
}
}
}
}
`;

this.locationResponse = (await context.octokit.graphql(graphQlQuery)) as LocationResponse;
console.trace(this.locationResponse);

this.user_id = this.locationResponse.data.node.author.id;
this.comment_id = this.locationResponse.data.node.id;
this.issue_id = this.locationResponse.data.node.issue.id;
this.repository_id = this.locationResponse.data.node.issue.repository.id;
this.node_id = this.locationResponse.data.node.issue.repository.id;
this.node_type = "IssueComment";

return this.locationResponse;
}
}

interface LocationResponse {
Expand Down
44 changes: 22 additions & 22 deletions src/adapters/supabase/helpers/tables/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,17 @@ export class Logs {
});
}

http(log: string, metadata?: any, postComment?: boolean): LogReturn | null {
metadata = this._addDiagnosticInformation(metadata);
return this._log({
level: LogLevel.HTTP,
consoleLog: this.console.http,
logMessage: log,
metadata,
postComment,
type: "http",
});
}
// http(log: string, metadata?: any, postComment?: boolean): LogReturn | null {
// metadata = this._addDiagnosticInformation(metadata);
// return this._log({
// level: LogLevel.HTTP,
// consoleLog: this.console.http,
// logMessage: log,
// metadata,
// postComment,
// type: "http",
// });
// }

verbose(log: string, metadata?: any, postComment?: boolean): LogReturn | null {
metadata = this._addDiagnosticInformation(metadata);
Expand All @@ -211,17 +211,17 @@ export class Logs {
});
}

silly(log: string, metadata?: any, postComment?: boolean): LogReturn | null {
metadata = this._addDiagnosticInformation(metadata);
return this._log({
level: LogLevel.SILLY,
consoleLog: this.console.silly,
logMessage: log,
metadata,
postComment,
type: "silly",
});
}
// silly(log: string, metadata?: any, postComment?: boolean): LogReturn | null {
// metadata = this._addDiagnosticInformation(metadata);
// return this._log({
// level: LogLevel.SILLY,
// consoleLog: this.console.silly,
// logMessage: log,
// metadata,
// postComment,
// type: "silly",
// });
// }

constructor(
supabase: SupabaseClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ContributorClassesKeys } from "./contribution-style-types";
import { FormatScoreConfig, FormatScoreConfigParams } from "./element-score-config";
import { Context } from "../../../../types/context";

export type Tags = keyof HTMLElementTagNameMap;
type Tags = keyof HTMLElementTagNameMap;

const md = new MarkdownIt();
const ZERO = new Decimal(0);
Expand Down
81 changes: 0 additions & 81 deletions src/handlers/comment/handlers/issue/default-roles-scoring.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/handlers/comment/handlers/issue/evaluate-comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export interface EnrichedRelevance {
score: Decimal;
}

export function enrichRelevanceData(
function enrichRelevanceData(
contributorComments: Comment[]
): (value: Decimal, index: number, array: Decimal[]) => EnrichedRelevance {
return (score, index) => ({
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/comment/handlers/issue/scoreSources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ interface ScoreParams {
*
*/

export function botCommandsAndHumanCommentsFilter(comment: Comment) {
function botCommandsAndHumanCommentsFilter(comment: Comment) {
return !comment.body.startsWith("/") /* No Commands */ && comment.user.type === "User";
} /* No Bots */
Loading

0 comments on commit 55c68b7

Please sign in to comment.