From 8f17b0635e97c4a8ec755c4f564ea2affb11ef42 Mon Sep 17 00:00:00 2001 From: ishowvel Date: Fri, 20 Dec 2024 20:57:12 +0530 Subject: [PATCH] chore: refactor and fix tests --- .../results/github-comment-results.json | 170 +++++++++--------- tests/__mocks__/results/output.html | 2 +- .../results/permit-generation-results.json | 164 ++++++++--------- .../results/review-incentivizer-results.json | 160 ++++++++--------- tests/process.issue.test.ts | 3 +- 5 files changed, 250 insertions(+), 249 deletions(-) diff --git a/tests/__mocks__/results/github-comment-results.json b/tests/__mocks__/results/github-comment-results.json index 8e15dbae..ba6bd93c 100644 --- a/tests/__mocks__/results/github-comment-results.json +++ b/tests/__mocks__/results/github-comment-results.json @@ -1,7 +1,7 @@ { "gentlementlegen": { "userId": 9807008, - "total": 2123.088, + "total": 1872.688, "task": { "reward": 400, "multiplier": 1 }, "comments": [ { @@ -10,7 +10,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2033404518", "type": "ISSUE_AUTHOR", "score": { - "reward": 19.104, + "reward": 16.704, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, "a": { "score": 1, "elementCount": 2 } }, "result": 3 @@ -27,7 +27,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2036174312", "type": "ISSUE_AUTHOR", "score": { - "reward": 73.152, + "reward": 65.152, "formatting": { "content": { "p": { "score": 1, "elementCount": 5 }, @@ -49,7 +49,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2036367126", "type": "ISSUE_AUTHOR", "score": { - "reward": 61.696, + "reward": 56.096, "formatting": { "content": { "p": { "score": 1, "elementCount": 3 }, @@ -70,7 +70,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2036385985", "type": "ISSUE_AUTHOR", "score": { - "reward": 61.12, + "reward": 57.12, "formatting": { "content": { "p": { "score": 1, "elementCount": 4 }, "a": { "score": 1, "elementCount": 1 } }, "result": 5 @@ -87,7 +87,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2036411811", "type": "ISSUE_AUTHOR", "score": { - "reward": 67.584, + "reward": 63.584, "formatting": { "content": { "p": { "score": 1, "elementCount": 5 } }, "result": 5 }, "priority": 4, "words": { "wordCount": 159, "wordValue": 0.2, "result": 14.87 }, @@ -101,7 +101,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2036458775", "type": "ISSUE_AUTHOR", "score": { - "reward": 23.296, + "reward": 22.496, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 55, "wordValue": 0.2, "result": 6.03 }, @@ -115,7 +115,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2036535332", "type": "ISSUE_AUTHOR", "score": { - "reward": 35.936, + "reward": 34.336, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, "code": { "score": 1, "elementCount": 1 } }, "result": 2 @@ -132,7 +132,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2051094255", "type": "ISSUE_AUTHOR", "score": { - "reward": 32.192, + "reward": 29.792, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, "code": { "score": 1, "elementCount": 2 } }, "result": 3 @@ -149,7 +149,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2054424028", "type": "ISSUE_AUTHOR", "score": { - "reward": 83.008, + "reward": 70.208, "formatting": { "content": { "p": { "score": 1, "elementCount": 5 }, @@ -208,7 +208,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";", "score": { - "reward": 84.344, + "reward": 69.944, "formatting": { "content": { "p": { "score": 1, "elementCount": 2 }, "code": { "score": 1, "elementCount": 4 } }, "result": 6 @@ -226,7 +226,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -27,29 +27,39 @@ formattingEvaluator:\n td: 1\n hr: 0\n multipliers:\n- - type: [ISSUE, ISSUER]:\n+ - type: [ISSUE, ISSUER, TASK]:\n+ formattingMultiplier: 1\n+ wordValue: 0.1\n+ - type: [ISSUE, ISSUER, COMMENT]:\n formattingMultiplier: 1\n wordValue: 0.2\n- - type: [ISSUE, ASSIGNEE]:\n+ - type: [ISSUE, ASSIGNEE, COMMENT]:", "score": { - "reward": 27.816, + "reward": 23.016, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, "code": { "score": 1, "elementCount": 1 } }, "result": 2 @@ -244,7 +244,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -0,0 +1,22 @@\n+// available tokens for payouts\n+export const PAYMENT_TOKEN_PER_NETWORK: Record = {\n+ \"1\": {\n+ rpc: \"https://rpc-bot.ubq.fi/v1/mainnet\",", "score": { - "reward": 27.2, + "reward": 22.4, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, "a": { "score": 1, "elementCount": 1 } }, "result": 2 @@ -262,7 +262,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";", "score": { - "reward": 49.76, + "reward": 42.56, "formatting": { "content": { "p": { "score": 1, "elementCount": 2 }, "code": { "score": 1, "elementCount": 1 } }, "result": 3 @@ -280,7 +280,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -27,29 +27,39 @@ formattingEvaluator:\n td: 1\n hr: 0\n multipliers:\n- - type: [ISSUE, ISSUER]:\n+ - type: [ISSUE, ISSUER, TASK]:\n+ formattingMultiplier: 1\n+ wordValue: 0.1\n+ - type: [ISSUE, ISSUER, COMMENT]:\n formattingMultiplier: 1\n wordValue: 0.2\n- - type: [ISSUE, ASSIGNEE]:\n+ - type: [ISSUE, ASSIGNEE, COMMENT]:", "score": { - "reward": 47.952, + "reward": 35.952, "formatting": { "content": { "p": { "score": 1, "elementCount": 2 }, @@ -302,7 +302,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}", "score": { - "reward": 54.456, + "reward": 44.856, "formatting": { "content": { "p": { "score": 1, "elementCount": 3 }, "a": { "score": 1, "elementCount": 1 } }, "result": 4 @@ -320,7 +320,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";", "score": { - "reward": 25.304, + "reward": 22.904, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 25, "wordValue": 0.2, "result": 3.09 }, @@ -335,7 +335,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -27,29 +27,39 @@ formattingEvaluator:\n td: 1\n hr: 0\n multipliers:\n- - type: [ISSUE, ISSUER]:\n+ - type: [ISSUE, ISSUER, TASK]:\n+ formattingMultiplier: 1\n+ wordValue: 0.1\n+ - type: [ISSUE, ISSUER, COMMENTED]:\n formattingMultiplier: 1\n wordValue: 0.2\n- - type: [ISSUE, ASSIGNEE]:\n+ - type: [ISSUE, ASSIGNEE, COMMENTED]:\n formattingMultiplier: 0\n wordValue: 0\n- - type: [ISSUE, COLLABORATOR]:\n+ - type: [ISSUE, COLLABORATOR, COMMENTED]:", "score": { - "reward": 50.32, + "reward": 43.12, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, @@ -357,7 +357,7 @@ "type": "PULL_AUTHOR", "diffHunk": "", "score": { - "reward": 43.04, + "reward": 35.84, "formatting": { "content": { "p": { "score": 1, "elementCount": 2 }, "a": { "score": 1, "elementCount": 1 } }, "result": 3 @@ -375,7 +375,7 @@ "type": "PULL_AUTHOR", "diffHunk": "", "score": { - "reward": 22.552, + "reward": 17.752, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, "a": { "score": 1, "elementCount": 1 } }, "result": 2 @@ -393,7 +393,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -0,0 +1,22 @@\n+// available tokens for payouts\n+export const PAYMENT_TOKEN_PER_NETWORK: Record = {\n+ \"1\": {\n+ rpc: \"https://rpc.gnosischain.com\",\n+ token: \"0x6B175474E89094C44Da98b954EedeAC495271d0F\",\n+ symbol: \"DAI\",\n+ },", "score": { - "reward": 57.2, + "reward": 47.6, "formatting": { "content": { "p": { "score": 1, "elementCount": 2 }, @@ -415,7 +415,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";", "score": { - "reward": 17.24, + "reward": 14.84, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 12, "wordValue": 0.2, "result": 1.65 }, @@ -430,7 +430,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -0,0 +1,216 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ body += result[key].evaluationCommentHtml;\n+ }\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ function createIncentiveRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function buildIncentiveRow(commentScore: GithubCommentScore) {\n+ // Properly escape carriage returns for HTML rendering\n+ const formatting = stringify(commentScore.score?.formatting?.content).replace(/[\\n\\r]/g, \" \");\n+ return `\n+ \n+ \n+
\n+ ${commentScore.content.replace(/(.{64})..+/, \"$1…\")}\n+
\n+ \n+ \n+
\n+ \n+ ${Object.values(commentScore.score?.formatting?.content || {}).reduce((acc, curr) => {\n+ return acc.add(curr.score * curr.count);\n+ }, new Decimal(0))}\n+ \n+
${formatting}
\n+
\n+ \n+ ${commentScore.score?.relevance || \"-\"}\n+ ${commentScore.score?.reward || \"-\"}\n+ `;\n+ }\n+\n+ for (const issueComment of sorted.issues.comments) {\n+ content.push(buildIncentiveRow(issueComment));\n+ }\n+ for (const reviewComment of sorted.reviews) {\n+ content.push(buildIncentiveRow(reviewComment));\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ return `\n+
\n+ \n+ \n+

\n+ \n+ [ ${result.total} ${getPayoutConfigByNetworkId(program.opts().evmNetworkId).symbol} ]\n+ \n+

\n+
\n+ @${username}\n+
\n+
\n+
\n+
Contributions Overview
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ ${createContributionRows()}\n+ \n+
ViewContributionCountReward
\n+
Conversation Incentives
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ ${createIncentiveRows()}\n+ \n+
CommentFormattingRelevanceReward
\n+
\n+ `\n+ .replace(/\\s+/g, \" \")", "score": { - "reward": 29.896, + "reward": 27.496, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 33, "wordValue": 0.2, "result": 3.91 }, @@ -445,7 +445,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -0,0 +1,41 @@\n+import { parseGitHubUrl } from \"../src/start\";\n+import { IssueActivity } from \"../src/issue-activity\";\n+import { Processor } from \"../src/parser/processor\";\n+import { UserExtractorModule } from \"../src/parser/user-extractor-module\";\n+import { server } from \"./__mocks__/node\";\n+import { DataPurgeModule } from \"../src/parser/data-purge-module\";\n+import userCommentResults from \"./__mocks__/results/user-comment-results.json\";\n+import dataPurgeResults from \"./__mocks__/results/data-purge-result.json\";\n+\n+const issueUrl = process.env.TEST_ISSUE_URL || \"https://github.com/ubiquity-os/comment-incentives/issues/22\";\n+\n+beforeAll(() => server.listen());\n+afterEach(() => server.resetHandlers());\n+afterAll(() => server.close());\n+\n+describe(\"Modules tests\", () => {\n+ const issue = parseGitHubUrl(issueUrl);\n+ const activity = new IssueActivity(issue);\n+\n+ beforeAll(async () => {\n+ await activity.init();\n+ });\n+\n+ it(\"Should extract users from comments\", async () => {\n+ const logSpy = jest.spyOn(console, \"log\");\n+ const processor = new Processor();\n+ processor[\"_transformers\"] = [new UserExtractorModule()];\n+ await processor.run(activity);\n+ processor.dump();\n+ expect(logSpy).toHaveBeenCalledWith(JSON.stringify(userCommentResults, undefined, 2));", "score": { - "reward": 56.432, + "reward": 51.632, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, "code": { "score": 1, "elementCount": 1 } }, "result": 2 @@ -463,7 +463,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(", "score": { - "reward": 33.304, + "reward": 28.504, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, "code": { "score": 1, "elementCount": 1 } }, "result": 2 @@ -481,7 +481,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))", "score": { - "reward": 24.688, + "reward": 22.288, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 24, "wordValue": 0.2, "result": 2.98 }, @@ -496,7 +496,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ function createIncentiveRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function buildIncentiveRow(commentScore: GithubCommentScore) {\n+ // Properly escape carriage returns for HTML rendering\n+ const formatting = stringify(commentScore.score?.formatting?.content).replace(/[\\n\\r]/g, \" \");\n+ return `\n+ \n+ \n+
\n+ ${commentScore.content.replace(/(.{64})..+/, \"$1…\")}\n+
\n+ \n+ \n+
\n+ \n+ ${Object.values(commentScore.score?.formatting?.content || {}).reduce((acc, curr) => {\n+ return acc.add(curr.score * curr.count);\n+ }, new Decimal(0))}\n+ \n+
${formatting}
\n+
\n+ \n+ ${commentScore.score?.relevance || \"-\"}\n+ ${commentScore.score?.reward || \"-\"}\n+ `;\n+ }\n+\n+ for (const issueComment of sorted.issues.comments) {\n+ content.push(buildIncentiveRow(issueComment));\n+ }\n+ for (const reviewComment of sorted.reviews) {\n+ content.push(buildIncentiveRow(reviewComment));\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ return `\n+
\n+ \n+ \n+

\n+ ", "score": { - "reward": 31.952, + "reward": 24.752, "formatting": { "content": { "p": { "score": 1, "elementCount": 2 }, "a": { "score": 1, "elementCount": 1 } }, "result": 3 @@ -514,7 +514,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000,", "score": { - "reward": 92.72, + "reward": 71.12, "formatting": { "content": { "p": { "score": 1, "elementCount": 5 }, @@ -537,7 +537,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))", "score": { - "reward": 36.16, + "reward": 31.36, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, "code": { "score": 1, "elementCount": 1 } }, "result": 2 @@ -555,7 +555,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000,", "score": { - "reward": 158.92, + "reward": 122.92, "formatting": { "content": { "p": { "score": 1, "elementCount": 8 }, "code": { "score": 1, "elementCount": 7 } }, "result": 15 @@ -573,7 +573,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))", "score": { - "reward": 38.072, + "reward": 35.672, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 48, "wordValue": 0.2, "result": 5.37 }, @@ -588,7 +588,7 @@ "type": "PULL_AUTHOR", "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000,", "score": { - "reward": 117.568, + "reward": 91.168, "formatting": { "content": { "p": { "score": 1, "elementCount": 5 }, @@ -609,7 +609,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/pull/12#issuecomment-2056635516", "type": "PULL_AUTHOR", "score": { - "reward": 29.88, + "reward": 22.68, "formatting": { "content": { "p": { "score": 1, "elementCount": 2 }, "a": { "score": 1, "elementCount": 1 } }, "result": 3 @@ -626,7 +626,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/pull/12#issuecomment-2063348339", "type": "PULL_AUTHOR", "score": { - "reward": 26.424, + "reward": 24.024, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 27, "wordValue": 0.2, "result": 3.29 }, @@ -661,11 +661,11 @@ { "reviewId": 2019198962, "effect": { "addition": 50, "deletion": 50 }, "reward": 1, "priority": 1 } ] }, - "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiIyMTIzMDg4MDAwMDAwMDAwMDAwMDAwIn0sIm5vbmNlIjoiODMwNzY0Mzc0NDY0OTk1ODkzMDQ2MTExMjg5NjM5MTY3MTAxMDY4ODYxMDI0MzYwMjM4ODE1MjAwNTgzNDY4MDA1Nzg3NTQ0MDE3NTUiLCJkZWFkbGluZSI6IjExNTc5MjA4OTIzNzMxNjE5NTQyMzU3MDk4NTAwODY4NzkwNzg1MzI2OTk4NDY2NTY0MDU2NDAzOTQ1NzU4NDAwNzkxMzEyOTYzOTkzNSJ9LCJ0cmFuc2ZlckRldGFpbHMiOnsidG8iOiIweDREMDcwNGY0MDBENTdCYTkzZUVhODg3NjVDM0ZjREJEODI2ZENGYzQiLCJyZXF1ZXN0ZWRBbW91bnQiOiIyMTIzMDg4MDAwMDAwMDAwMDAwMDAwIn0sIm93bmVyIjoiMHhkOTUzMEYzZmJCRWExMWJlRDAxREMwOUU3OTMxOGYyZjIwMjIzNzE2Iiwic2lnbmF0dXJlIjoiMHhjNTIwZWZiNTg4YTM1MjdkMTRlNjA3OGU5ZTBjZDY3NzIzMzcxNTJiN2IyZjg5Yzc1MWFiMjlhZmNmZDNhMTUxNzIwZDRhYTZkZjJhYzEzODVjNjFiZGMyMmZhOTQyOGY0NWQzNDA1NWE2ODM2MWUyNGRmZWFkZjFlODcwMzRkYTFjIiwibmV0d29ya0lkIjoxMDB9XQ==", - "evaluationCommentHtml": "

 [ 2123.088 WXDAI ] 

@gentlementlegen
⚠️ Your rewards have been limited to the task price of 400 WXDAI.
Contributions Overview
ViewContributionCountReward
IssueTask1400
ReviewCode Review2121
IssueSpecification161.8
IssueComment9457.088
ReviewComment251183.2
Review Details
ChangesPriorityReward
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
Conversation Incentives
CommentFormattingRelevancePriorityReward
In the v1 of the Ubiquibot, when a result gets evaluated, a reca…
15.45
content:
  content:
    p:
      score: 1
      elementCount: 6
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 11
regex:
  wordCount: 87
  wordValue: 0.1
  result: 4.45
1461.8
This needs https://github.com/ubiquity-os/conversation-rewards/p…
5.22
content:
  content:
    p:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 17
  wordValue: 0.2
  result: 2.22
0.8419.104
To me 1 is the most straightforward to do for few reasons:- th…
20.36
content:
  content:
    p:
      score: 1
      elementCount: 5
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 10
regex:
  wordCount: 104
  wordValue: 0.2
  result: 10.36
0.8473.152
I think each plugin should output JSON not html as it is not rel…
17.53
content:
  content:
    p:
      score: 1
      elementCount: 3
    code:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 7
regex:
  wordCount: 106
  wordValue: 0.2
  result: 10.53
0.8461.696
If you want to manipulate and convey data, HTML really is not ma…
17.85
content:
  content:
    p:
      score: 1
      elementCount: 4
    a:
      score: 1
      elementCount: 1
  result: 5
regex:
  wordCount: 134
  wordValue: 0.2
  result: 12.85
0.8461.12
But then how do we consider the formatting of that output?Prac…
19.87
content:
  content:
    p:
      score: 1
      elementCount: 5
  result: 5
regex:
  wordCount: 159
  wordValue: 0.2
  result: 14.87
0.8467.584
This can work, but we skyrocket coupling and to me defeat purpos…
7.03
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 55
  wordValue: 0.2
  result: 6.03
0.8423.296
@pavlovcik To mitigate that that's why inside the comment reward…
10.73
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 85
  wordValue: 0.2
  result: 8.73
0.8435.936
I realized that to carry this task properly we need to handle fl…
9.31
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 58
  wordValue: 0.2
  result: 6.31
0.8432.192
Agreed, I think currently there are 3 possible things to annotat…
21.94
content:
  content:
    p:
      score: 1
      elementCount: 5
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 3
    code:
      score: 1
      elementCount: 7
  result: 16
regex:
  wordCount: 54
  wordValue: 0.2
  result: 5.94
0.8483.008
Resolves #5 Depends on #8 Reviews looks gigantic but it's on…
3
content:
  content:
    p:
      score: 1
      elementCount: 3
  result: 3
regex:
  wordCount: 19
  wordValue: 0
  result: 0
0.740
I think in this case it makes sense because this function will r…
12.49
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 4
  result: 6
regex:
  wordCount: 60
  wordValue: 0.2
  result: 6.49
0.7484.344
It is supposed to represent a comment. Would you prefer a descri…
4.11
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 16
  wordValue: 0.2
  result: 2.11
0.7427.816
True, just picked this up from the previous codebase. https://rp…
4
content:
  content:
    p:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 15
  wordValue: 0.2
  result: 2
0.7427.2
Seems convoluted to me and I don't know what problem that solved…
7.6
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 40
  wordValue: 0.2
  result: 4.6
0.7449.76
Changed `COMMENT` to `COMMENTED`, added jsdoc de…
6.42
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 5
regex:
  wordCount: 10
  wordValue: 0.2
  result: 1.42
0.7447.952
Simply makes the docs linking the code within the comment, for c…
8.01
content:
  content:
    p:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 4
regex:
  wordCount: 34
  wordValue: 0.2
  result: 4.01
0.7454.456
In the case of a string it would coerce the value and you would …
4.09
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 25
  wordValue: 0.2
  result: 3.09
0.7425.304
`observe` would help to chose what we want to include an…
7.7
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 41
  wordValue: 0.2
  result: 4.7
0.7450.32
Not very useful indeed. I am working on the tests on a separate …
6.4
content:
  content:
    p:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 28
  wordValue: 0.2
  result: 3.4
0.7443.04
See https://github.com/ubiquity-os/conversation-rewards/pull/14 …
3.17
content:
  content:
    p:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 8
  wordValue: 0.2
  result: 1.17
0.7422.552
Good point, also symbol should not be DAI but ETH isn't it? …
8.5
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 4
regex:
  wordCount: 39
  wordValue: 0.2
  result: 4.5
0.7457.2
Had changed it everywhere else but here, now it should be fine
2.65
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 12
  wordValue: 0.2
  result: 1.65
0.7417.24
This matches any whitespace character (spaces, tabs, line breaks…
4.91
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 33
  wordValue: 0.2
  result: 3.91
0.7429.896
By definition `dump` was just outputting results to stdo…
9.22
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 68
  wordValue: 0.2
  result: 7.22
0.7456.432
Un-nested them one level. I think that the `buildXrow` s…
5.09
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 25
  wordValue: 0.2
  result: 3.09
0.7433.304
I assumed BigInt only handles integers, and we manipulate a lot …
3.98
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 24
  wordValue: 0.2
  result: 2.98
0.7424.688
There is one permit generated per participating user, last run:…
4.42
content:
  content:
    p:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 10
  wordValue: 0.2
  result: 1.42
0.7431.952
I made it according to the previous version:- Issue Specificat…
12.7
content:
  content:
    p:
      score: 1
      elementCount: 5
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 9
regex:
  wordCount: 31
  wordValue: 0.2
  result: 3.7
0.7492.72
Wouldn't that lead to precision loss in JS and after the divisio…
5.6
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 30
  wordValue: 0.2
  result: 3.6
0.7436.16
That is correct. I understand now why you're confused:The valu…
21.95
content:
  content:
    p:
      score: 1
      elementCount: 8
    code:
      score: 1
      elementCount: 7
  result: 15
regex:
  wordCount: 65
  wordValue: 0.2
  result: 6.95
0.74158.92
I don't think is it relevant in this scenario because we are not…
6.37
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 48
  wordValue: 0.2
  result: 5.37
0.7438.072
@whilefoo you are correct, these were wrongly used. I corrected …
16.28
content:
  content:
    p:
      score: 1
      elementCount: 5
    code:
      score: 1
      elementCount: 5
    a:
      score: 1
      elementCount: 1
  result: 11
regex:
  wordCount: 47
  wordValue: 0.2
  result: 5.28
0.74117.568
Example of successful comment posting with results:https://git…
4.05
content:
  content:
    p:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 7
  wordValue: 0.2
  result: 1.05
0.7429.88
@0x4007 I believe that if I had all the tests in this PR it will…
4.29
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 27
  wordValue: 0.2
  result: 3.29
0.7426.424
" + "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiIxODcyNjg4MDAwMDAwMDAwMDAwMDAwIn0sIm5vbmNlIjoiODMwNzY0Mzc0NDY0OTk1ODkzMDQ2MTExMjg5NjM5MTY3MTAxMDY4ODYxMDI0MzYwMjM4ODE1MjAwNTgzNDY4MDA1Nzg3NTQ0MDE3NTUiLCJkZWFkbGluZSI6IjExNTc5MjA4OTIzNzMxNjE5NTQyMzU3MDk4NTAwODY4NzkwNzg1MzI2OTk4NDY2NTY0MDU2NDAzOTQ1NzU4NDAwNzkxMzEyOTYzOTkzNSJ9LCJ0cmFuc2ZlckRldGFpbHMiOnsidG8iOiIweDREMDcwNGY0MDBENTdCYTkzZUVhODg3NjVDM0ZjREJEODI2ZENGYzQiLCJyZXF1ZXN0ZWRBbW91bnQiOiIxODcyNjg4MDAwMDAwMDAwMDAwMDAwIn0sIm93bmVyIjoiMHhkOTUzMEYzZmJCRWExMWJlRDAxREMwOUU3OTMxOGYyZjIwMjIzNzE2Iiwic2lnbmF0dXJlIjoiMHgzNTYxOTEzMmJhNGQwYzc2ZDkzZWJjZjE5M2JmNjkyYmU5ODdhNTVlZmI2YWM5ODA0ZDE4NDhiODJiZmMzM2FkNmM1YjkyMzU0YjRlODI5ZjgzODk5MTgwNjk2MzVhYTZhYWRmYTJiZGUwN2NkYzNhMTU3ZWUwYTRmY2RmNTcwNTFjIiwibmV0d29ya0lkIjoxMDB9XQ==", + "evaluationCommentHtml": "

 [ 1872.688 WXDAI ] 

@gentlementlegen
⚠️ Your rewards have been limited to the task price of 400 WXDAI.
Contributions Overview
ViewContributionCountReward
IssueTask1400
ReviewCode Review2121
IssueSpecification161.8
IssueComment9415.488
ReviewComment25974.4
Review Details
ChangesPriorityReward
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
Conversation Incentives
CommentFormattingRelevancePriorityReward
In the v1 of the Ubiquibot, when a result gets evaluated, a reca…
15.45
content:
  content:
    p:
      score: 1
      elementCount: 6
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 11
regex:
  wordCount: 87
  wordValue: 0.1
  result: 4.45
1461.8
This needs https://github.com/ubiquity-os/conversation-rewards/p…
5.22
content:
  content:
    p:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 17
  wordValue: 0.2
  result: 2.22
0.8416.704
To me 1 is the most straightforward to do for few reasons:- th…
20.36
content:
  content:
    p:
      score: 1
      elementCount: 5
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 10
regex:
  wordCount: 104
  wordValue: 0.2
  result: 10.36
0.8465.152
I think each plugin should output JSON not html as it is not rel…
17.53
content:
  content:
    p:
      score: 1
      elementCount: 3
    code:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 7
regex:
  wordCount: 106
  wordValue: 0.2
  result: 10.53
0.8456.096
If you want to manipulate and convey data, HTML really is not ma…
17.85
content:
  content:
    p:
      score: 1
      elementCount: 4
    a:
      score: 1
      elementCount: 1
  result: 5
regex:
  wordCount: 134
  wordValue: 0.2
  result: 12.85
0.8457.12
But then how do we consider the formatting of that output?Prac…
19.87
content:
  content:
    p:
      score: 1
      elementCount: 5
  result: 5
regex:
  wordCount: 159
  wordValue: 0.2
  result: 14.87
0.8463.584
This can work, but we skyrocket coupling and to me defeat purpos…
7.03
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 55
  wordValue: 0.2
  result: 6.03
0.8422.496
@pavlovcik To mitigate that that's why inside the comment reward…
10.73
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 85
  wordValue: 0.2
  result: 8.73
0.8434.336
I realized that to carry this task properly we need to handle fl…
9.31
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 58
  wordValue: 0.2
  result: 6.31
0.8429.792
Agreed, I think currently there are 3 possible things to annotat…
21.94
content:
  content:
    p:
      score: 1
      elementCount: 5
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 3
    code:
      score: 1
      elementCount: 7
  result: 16
regex:
  wordCount: 54
  wordValue: 0.2
  result: 5.94
0.8470.208
Resolves #5 Depends on #8 Reviews looks gigantic but it's on…
3
content:
  content:
    p:
      score: 1
      elementCount: 3
  result: 3
regex:
  wordCount: 19
  wordValue: 0
  result: 0
0.740
I think in this case it makes sense because this function will r…
12.49
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 4
  result: 6
regex:
  wordCount: 60
  wordValue: 0.2
  result: 6.49
0.7469.944
It is supposed to represent a comment. Would you prefer a descri…
4.11
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 16
  wordValue: 0.2
  result: 2.11
0.7423.016
True, just picked this up from the previous codebase. https://rp…
4
content:
  content:
    p:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 15
  wordValue: 0.2
  result: 2
0.7422.4
Seems convoluted to me and I don't know what problem that solved…
7.6
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 40
  wordValue: 0.2
  result: 4.6
0.7442.56
Changed `COMMENT` to `COMMENTED`, added jsdoc de…
6.42
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 5
regex:
  wordCount: 10
  wordValue: 0.2
  result: 1.42
0.7435.952
Simply makes the docs linking the code within the comment, for c…
8.01
content:
  content:
    p:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 4
regex:
  wordCount: 34
  wordValue: 0.2
  result: 4.01
0.7444.856
In the case of a string it would coerce the value and you would …
4.09
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 25
  wordValue: 0.2
  result: 3.09
0.7422.904
`observe` would help to chose what we want to include an…
7.7
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 41
  wordValue: 0.2
  result: 4.7
0.7443.12
Not very useful indeed. I am working on the tests on a separate …
6.4
content:
  content:
    p:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 28
  wordValue: 0.2
  result: 3.4
0.7435.84
See https://github.com/ubiquity-os/conversation-rewards/pull/14 …
3.17
content:
  content:
    p:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 8
  wordValue: 0.2
  result: 1.17
0.7417.752
Good point, also symbol should not be DAI but ETH isn't it? …
8.5
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 4
regex:
  wordCount: 39
  wordValue: 0.2
  result: 4.5
0.7447.6
Had changed it everywhere else but here, now it should be fine
2.65
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 12
  wordValue: 0.2
  result: 1.65
0.7414.84
This matches any whitespace character (spaces, tabs, line breaks…
4.91
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 33
  wordValue: 0.2
  result: 3.91
0.7427.496
By definition `dump` was just outputting results to stdo…
9.22
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 68
  wordValue: 0.2
  result: 7.22
0.7451.632
Un-nested them one level. I think that the `buildXrow` s…
5.09
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 25
  wordValue: 0.2
  result: 3.09
0.7428.504
I assumed BigInt only handles integers, and we manipulate a lot …
3.98
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 24
  wordValue: 0.2
  result: 2.98
0.7422.288
There is one permit generated per participating user, last run:…
4.42
content:
  content:
    p:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 10
  wordValue: 0.2
  result: 1.42
0.7424.752
I made it according to the previous version:- Issue Specificat…
12.7
content:
  content:
    p:
      score: 1
      elementCount: 5
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 9
regex:
  wordCount: 31
  wordValue: 0.2
  result: 3.7
0.7471.12
Wouldn't that lead to precision loss in JS and after the divisio…
5.6
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 30
  wordValue: 0.2
  result: 3.6
0.7431.36
That is correct. I understand now why you're confused:The valu…
21.95
content:
  content:
    p:
      score: 1
      elementCount: 8
    code:
      score: 1
      elementCount: 7
  result: 15
regex:
  wordCount: 65
  wordValue: 0.2
  result: 6.95
0.74122.92
I don't think is it relevant in this scenario because we are not…
6.37
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 48
  wordValue: 0.2
  result: 5.37
0.7435.672
@whilefoo you are correct, these were wrongly used. I corrected …
16.28
content:
  content:
    p:
      score: 1
      elementCount: 5
    code:
      score: 1
      elementCount: 5
    a:
      score: 1
      elementCount: 1
  result: 11
regex:
  wordCount: 47
  wordValue: 0.2
  result: 5.28
0.7491.168
Example of successful comment posting with results:https://git…
4.05
content:
  content:
    p:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 7
  wordValue: 0.2
  result: 1.05
0.7422.68
@0x4007 I believe that if I had all the tests in this PR it will…
4.29
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 27
  wordValue: 0.2
  result: 3.29
0.7424.024
" }, "0x4007": { - "total": 631.356, + "total": 543.356, "userId": 4975670, "comments": [ { @@ -674,7 +674,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2030164289", "type": "ISSUE_COLLABORATOR", "score": { - "reward": 16.448, + "reward": 14.848, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, @@ -695,7 +695,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2033488255", "type": "ISSUE_COLLABORATOR", "score": { - "reward": 7.552, + "reward": 6.752, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 17, "wordValue": 0.1, "result": 1.11 }, @@ -709,7 +709,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2036355445", "type": "ISSUE_COLLABORATOR", "score": { - "reward": 87.072, + "reward": 77.472, "formatting": { "content": { "p": { "score": 1, "elementCount": 7 }, @@ -731,7 +731,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2036370459", "type": "ISSUE_COLLABORATOR", "score": { - "reward": 59.776, + "reward": 52.576, "formatting": { "content": { "p": { "score": 1, "elementCount": 4 }, @@ -752,7 +752,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2036393020", "type": "ISSUE_COLLABORATOR", "score": { - "reward": 47.904, + "reward": 42.304, "formatting": { "content": { "p": { "score": 1, "elementCount": 2 }, @@ -773,7 +773,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2036433646", "type": "ISSUE_COLLABORATOR", "score": { - "reward": 74.624, + "reward": 65.824, "formatting": { "content": { "p": { "score": 1, "elementCount": 6 }, @@ -796,7 +796,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2036516869", "type": "ISSUE_COLLABORATOR", "score": { - "reward": 47.776, + "reward": 41.376, "formatting": { "content": { "p": { "score": 1, "elementCount": 5 }, @@ -818,7 +818,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2053332029", "type": "ISSUE_COLLABORATOR", "score": { - "reward": 35.616, + "reward": 31.616, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, @@ -839,7 +839,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2055783331", "type": "ISSUE_COLLABORATOR", "score": { - "reward": 9.6, + "reward": 8.8, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 29, "wordValue": 0.1, "result": 1.75 }, @@ -853,7 +853,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/pull/12#pullrequestreview-2007841578", "type": "PULL_COLLABORATOR", "score": { - "reward": 5.092, + "reward": 3.892, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 5, "wordValue": 0.1, "result": 0.39 }, @@ -868,7 +868,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -27,29 +27,39 @@ formattingEvaluator:\n td: 1\n hr: 0\n multipliers:\n- - type: [ISSUE, ISSUER]:\n+ - type: [ISSUE, ISSUER, TASK]:\n+ formattingMultiplier: 1\n+ wordValue: 0.1\n+ - type: [ISSUE, ISSUER, COMMENT]:\n formattingMultiplier: 1\n wordValue: 0.2\n- - type: [ISSUE, ASSIGNEE]:\n+ - type: [ISSUE, ASSIGNEE, COMMENT]:", "score": { - "reward": 5.456, + "reward": 4.256, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 7, "wordValue": 0.1, "result": 0.52 }, @@ -883,7 +883,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";", "score": { - "reward": 11.644, + "reward": 10.444, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 49, "wordValue": 0.1, "result": 2.73 }, @@ -898,7 +898,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -0,0 +1,22 @@\n+// available tokens for payouts\n+export const PAYMENT_TOKEN_PER_NETWORK: Record = {\n+ \"1\": {\n+ rpc: \"https://rpc-bot.ubq.fi/v1/mainnet\",", "score": { - "reward": 5.288, + "reward": 4.088, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 6, "wordValue": 0.1, "result": 0.46 }, @@ -913,7 +913,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -27,29 +27,39 @@ formattingEvaluator:\n td: 1\n hr: 0\n multipliers:\n- - type: [ISSUE, ISSUER]:\n+ - type: [ISSUE, ISSUER, TASK]:\n+ formattingMultiplier: 1\n+ wordValue: 0.1\n+ - type: [ISSUE, ISSUER, COMMENT]:\n formattingMultiplier: 1\n wordValue: 0.2\n- - type: [ISSUE, ASSIGNEE]:\n+ - type: [ISSUE, ASSIGNEE, COMMENT]:", "score": { - "reward": 16.76, + "reward": 13.16, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, "code": { "score": 1, "elementCount": 2 } }, "result": 3 @@ -931,7 +931,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";", "score": { - "reward": 10.632, + "reward": 8.232, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, "code": { "score": 1, "elementCount": 1 } }, "result": 2 @@ -949,7 +949,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -27,29 +27,39 @@ formattingEvaluator:\n td: 1\n hr: 0\n multipliers:\n- - type: [ISSUE, ISSUER]:\n+ - type: [ISSUE, ISSUER, TASK]:\n+ formattingMultiplier: 1\n+ wordValue: 0.1\n+ - type: [ISSUE, ISSUER, COMMENTED]:\n formattingMultiplier: 1\n wordValue: 0.2\n- - type: [ISSUE, ASSIGNEE]:\n+ - type: [ISSUE, ASSIGNEE, COMMENTED]:\n formattingMultiplier: 0\n wordValue: 0\n- - type: [ISSUE, COLLABORATOR]:\n+ - type: [ISSUE, COLLABORATOR, COMMENTED]:", "score": { - "reward": 12.172, + "reward": 9.772, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, @@ -971,7 +971,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}", "score": { - "reward": 5.092, + "reward": 3.892, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 5, "wordValue": 0.1, "result": 0.39 }, @@ -986,7 +986,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -73,12 +103,17 @@ export class IssueActivity {\n self: GitHubPullRequest | GitHubIssue | null\n ) {\n let ret = 0;\n- ret |= \"pull_request_review_id\" in comment ? CommentType.REVIEW : CommentType.ISSUE;\n+ ret |= \"pull_request_review_id\" in comment || \"draft\" in comment ? CommentType.REVIEW : CommentType.ISSUE;", "score": { - "reward": 5.652, + "reward": 4.452, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 8, "wordValue": 0.1, "result": 0.59 }, @@ -1001,7 +1001,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";", "score": { - "reward": 25.744, + "reward": 20.944, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, @@ -1023,7 +1023,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -27,29 +27,39 @@ formattingEvaluator:\n td: 1\n hr: 0\n multipliers:\n- - type: [ISSUE, ISSUER]:\n+ - type: [ISSUE, ISSUER, TASK]:\n+ formattingMultiplier: 1\n+ wordValue: 0.1\n+ - type: [ISSUE, ISSUER, COMMENTED]:\n formattingMultiplier: 1\n wordValue: 0.2\n- - type: [ISSUE, ASSIGNEE]:\n+ - type: [ISSUE, ASSIGNEE, COMMENTED]:\n formattingMultiplier: 0\n wordValue: 0\n- - type: [ISSUE, COLLABORATOR]:\n+ - type: [ISSUE, COLLABORATOR, COMMENTED]:", "score": { - "reward": 8.032, + "reward": 6.832, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 23, "wordValue": 0.1, "result": 1.44 }, @@ -1038,7 +1038,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -0,0 +1,212 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";", "score": { - "reward": 5.092, + "reward": 3.892, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 5, "wordValue": 0.1, "result": 0.39 }, @@ -1053,7 +1053,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -0,0 +1,216 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ body += result[key].evaluationCommentHtml;\n+ }\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ function createIncentiveRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function buildIncentiveRow(commentScore: GithubCommentScore) {\n+ // Properly escape carriage returns for HTML rendering\n+ const formatting = stringify(commentScore.score?.formatting?.content).replace(/[\\n\\r]/g, \" \");\n+ return `\n+ \n+ \n+
\n+ ${commentScore.content.replace(/(.{64})..+/, \"$1…\")}\n+
\n+ \n+ \n+
\n+ \n+ ${Object.values(commentScore.score?.formatting?.content || {}).reduce((acc, curr) => {\n+ return acc.add(curr.score * curr.count);\n+ }, new Decimal(0))}\n+ \n+
${formatting}
\n+
\n+ \n+ ${commentScore.score?.relevance || \"-\"}\n+ ${commentScore.score?.reward || \"-\"}\n+ `;\n+ }\n+\n+ for (const issueComment of sorted.issues.comments) {\n+ content.push(buildIncentiveRow(issueComment));\n+ }\n+ for (const reviewComment of sorted.reviews) {\n+ content.push(buildIncentiveRow(reviewComment));\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ return `\n+
\n+ \n+ \n+

\n+ \n+ [ ${result.total} ${getPayoutConfigByNetworkId(program.opts().evmNetworkId).symbol} ]\n+ \n+

\n+
\n+ @${username}\n+
\n+
\n+
\n+
Contributions Overview
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ ${createContributionRows()}\n+ \n+
ViewContributionCountReward
\n+
Conversation Incentives
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ ${createIncentiveRows()}\n+ \n+
CommentFormattingRelevanceReward
\n+
\n+ `\n+ .replace(/\\s+/g, \" \")", "score": { - "reward": 15.416, + "reward": 11.816, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, "code": { "score": 1, "elementCount": 2 } }, "result": 3 @@ -1071,7 +1071,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -0,0 +1,22 @@\n+// available tokens for payouts\n+export const PAYMENT_TOKEN_PER_NETWORK: Record = {\n+ \"1\": {\n+ rpc: \"https://rpc.gnosischain.com\",\n+ token: \"0x6B175474E89094C44Da98b954EedeAC495271d0F\",\n+ symbol: \"DAI\",\n+ },", "score": { - "reward": 8.312, + "reward": 7.112, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 25, "wordValue": 0.1, "result": 1.54 }, @@ -1086,7 +1086,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "", "score": { - "reward": 5.456, + "reward": 4.256, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 7, "wordValue": 0.1, "result": 0.52 }, @@ -1101,7 +1101,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "", "score": { - "reward": 4.504, + "reward": 3.304, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 2, "wordValue": 0.1, "result": 0.18 }, @@ -1116,7 +1116,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -0,0 +1,22 @@\n+// available tokens for payouts\n+export const PAYMENT_TOKEN_PER_NETWORK: Record = {\n+ \"1\": {\n+ rpc: \"https://rpc.gnosischain.com\",\n+ token: \"0x6B175474E89094C44Da98b954EedeAC495271d0F\",\n+ symbol: \"DAI\",\n+ },", "score": { - "reward": 5.652, + "reward": 4.452, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 8, "wordValue": 0.1, "result": 0.59 }, @@ -1131,7 +1131,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -0,0 +1,216 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ let body = \"\";\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ body += result[key].evaluationCommentHtml;\n+ }\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ function createIncentiveRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function buildIncentiveRow(commentScore: GithubCommentScore) {\n+ // Properly escape carriage returns for HTML rendering\n+ const formatting = stringify(commentScore.score?.formatting?.content).replace(/[\\n\\r]/g, \" \");\n+ return `\n+ \n+ \n+
\n+ ${commentScore.content.replace(/(.{64})..+/, \"$1…\")}\n+
\n+ \n+ \n+
\n+ \n+ ${Object.values(commentScore.score?.formatting?.content || {}).reduce((acc, curr) => {\n+ return acc.add(curr.score * curr.count);\n+ }, new Decimal(0))}\n+ \n+
${formatting}
\n+
\n+ \n+ ${commentScore.score?.relevance || \"-\"}\n+ ${commentScore.score?.reward || \"-\"}\n+ `;\n+ }\n+\n+ for (const issueComment of sorted.issues.comments) {\n+ content.push(buildIncentiveRow(issueComment));\n+ }\n+ for (const reviewComment of sorted.reviews) {\n+ content.push(buildIncentiveRow(reviewComment));\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ return `\n+
\n+ \n+ \n+

\n+ \n+ [ ${result.total} ${getPayoutConfigByNetworkId(program.opts().evmNetworkId).symbol} ]\n+ \n+

\n+
\n+ @${username}\n+
\n+
\n+
\n+
Contributions Overview
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ ${createContributionRows()}\n+ \n+
ViewContributionCountReward
\n+
Conversation Incentives
\n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ \n+ ${createIncentiveRows()}\n+ \n+
CommentFormattingRelevanceReward
\n+
\n+ `\n+ .replace(/\\s+/g, \" \")", "score": { - "reward": 4.504, + "reward": 3.304, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 2, "wordValue": 0.1, "result": 0.18 }, @@ -1146,7 +1146,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))", "score": { - "reward": 17.04, + "reward": 13.44, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 }, "code": { "score": 1, "elementCount": 2 } }, "result": 3 @@ -1164,7 +1164,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000,", "score": { - "reward": 10.58, + "reward": 9.38, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 41, "wordValue": 0.1, "result": 2.35 }, @@ -1179,7 +1179,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000,", "score": { - "reward": 26.14, + "reward": 22.54, "formatting": { "content": { "p": { "score": 1, "elementCount": 3 } }, "result": 3 }, "priority": 4, "words": { "wordCount": 101, "wordValue": 0.1, "result": 5.05 }, @@ -1194,7 +1194,7 @@ "type": "PULL_COLLABORATOR", "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))", "score": { - "reward": 8.76, + "reward": 7.56, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 28, "wordValue": 0.1, "result": 1.7 }, @@ -1208,7 +1208,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/pull/12#issuecomment-2063712447", "type": "PULL_COLLABORATOR", "score": { - "reward": 6.968, + "reward": 5.768, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 16, "wordValue": 0.1, "result": 1.06 }, @@ -1237,11 +1237,11 @@ { "reviewId": 2017922720, "effect": { "addition": 50, "deletion": 50 }, "reward": 1, "priority": 1 } ] }, - "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI2MzEzNTYwMDAwMDAwMDAwMDAwMDAifSwibm9uY2UiOiIzMzkyOTQxNzYyNzkzOTc1NTkzMTc4MTExNTY1OTgzNzk3NDc1ODk0MDM3NDk1NDA0MTMxMjg2MzgyNzgwNDExNjg3NzA4MzUyODg4IiwiZGVhZGxpbmUiOiIxMTU3OTIwODkyMzczMTYxOTU0MjM1NzA5ODUwMDg2ODc5MDc4NTMyNjk5ODQ2NjU2NDA1NjQwMzk0NTc1ODQwMDc5MTMxMjk2Mzk5MzUifSwidHJhbnNmZXJEZXRhaWxzIjp7InRvIjoiMHg0RDA3MDRmNDAwRDU3QmE5M2VFYTg4NzY1QzNGY0RCRDgyNmRDRmM0IiwicmVxdWVzdGVkQW1vdW50IjoiNjMxMzU2MDAwMDAwMDAwMDAwMDAwIn0sIm93bmVyIjoiMHhkOTUzMEYzZmJCRWExMWJlRDAxREMwOUU3OTMxOGYyZjIwMjIzNzE2Iiwic2lnbmF0dXJlIjoiMHgwYmU4ZTdhZmFiMjQwNWE0YzMzMWNhZWFlNDFjZjQzOTIwOTdlNzU4ZmJmYmNkYjYxZjZlNjkxNWEwNzQwYzIxMmJlMDA2NTUzMjU1OTYzZGUwM2I4ZGYyOGExNmE3NTI0MjViZmNhODBlZjgxNTAyMzg0ZTcxMDdlYmQ1ZTFlOTFjIiwibmV0d29ya0lkIjoxMDB9XQ==", - "evaluationCommentHtml": "

 [ 631.356 WXDAI ] 

@0x4007
⚠️ Your rewards have been limited to the task price of 400 WXDAI.
Contributions Overview
ViewContributionCountReward
ReviewCode Review1515
IssueComment9386.368
ReviewComment23229.988
Review Details
ChangesPriorityReward
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
Conversation Incentives
CommentFormattingRelevancePriorityReward
@whilefoo rfc on how we can deal with comment outputs. Perhaps w…
4.64
content:
  content:
    p:
      score: 1
      elementCount: 1
    pre:
      score: 0
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 47
  wordValue: 0.1
  result: 2.64
0.8416.448
I think you should fork from and overtake that second pull due t…
2.11
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 17
  wordValue: 0.1
  result: 1.11
0.847.552
I think the most pure architecture would be that plugins can NOT…
24.21
content:
  content:
    p:
      score: 1
      elementCount: 7
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 2
  result: 12
regex:
  wordCount: 285
  wordValue: 0.1
  result: 12.21
0.8487.072
I know JSON makes things more complicated than it needs to be wi…
16.43
content:
  content:
    p:
      score: 1
      elementCount: 4
    code:
      score: 1
      elementCount: 4
    a:
      score: 1
      elementCount: 1
  result: 9
regex:
  wordCount: 159
  wordValue: 0.1
  result: 7.43
0.8459.776
Going back to my \"plugin-side-rendering\" mention, the data manip…
13.22
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 5
    pre:
      score: 0
      elementCount: 1
  result: 7
regex:
  wordCount: 129
  wordValue: 0.1
  result: 6.22
0.8447.904
The proposed `comment` output is intended for ease of co…
20.57
content:
  content:
    p:
      score: 1
      elementCount: 6
    code:
      score: 1
      elementCount: 3
    h3:
      score: 1
      elementCount: 1
    pre:
      score: 0
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 11
regex:
  wordCount: 214
  wordValue: 0.1
  result: 9.57
0.8474.624
I understand your concern and I would need to put more thought i…
12.93
content:
  content:
    p:
      score: 1
      elementCount: 5
    code:
      score: 1
      elementCount: 1
    ol:
      score: 0
      elementCount: 1
    li:
      score: 1
      elementCount: 2
  result: 8
regex:
  wordCount: 98
  wordValue: 0.1
  result: 4.93
0.8447.776
I see, so you're suggesting that we must annotate each comment a…
9.88
content:
  content:
    p:
      score: 1
      elementCount: 1
    ol:
      score: 0
      elementCount: 1
    li:
      score: 1
      elementCount: 4
  result: 5
regex:
  wordCount: 97
  wordValue: 0.1
  result: 4.88
0.8435.616
Consider calling it \"contributor\" and \"collaborator\" as that is …
2.75
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 29
  wordValue: 0.1
  result: 1.75
0.849.6
Nice code quality per usual
1.39
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 5
  wordValue: 0.1
  result: 0.39
0.745.092
\"Comment\" implication isn't clear to me
1.52
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 7
  wordValue: 0.1
  result: 0.52
0.745.456
I've always been anti empty string for variable declarations. It…
3.73
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 49
  wordValue: 0.1
  result: 2.73
0.7411.644
Our RPCs don't work anymore
1.46
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 6
  wordValue: 0.1
  result: 0.46
0.745.288
Yes consider changing them to verbs `ISSUER``COMME…
4.7
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 28
  wordValue: 0.1
  result: 1.7
0.7416.76
`[].join(\"\");` yields an empty string as well if there's…
2.94
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 14
  wordValue: 0.1
  result: 0.94
0.7410.632
Perhaps it will make the config more expressive if you add other…
3.49
content:
  content:
    p:
      score: 1
      elementCount: 1
    pre:
      score: 0
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 24
  wordValue: 0.1
  result: 1.49
0.7412.172
What is this @link syntax
1.39
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 5
  wordValue: 0.1
  result: 0.39
0.745.092
Just noticed the bit wise operators 1337 code
1.59
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 8
  wordValue: 0.1
  result: 0.59
0.745.652
It might seem convoluted but I think that it condenses the logic…
7.48
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 3
    pre:
      score: 0
      elementCount: 1
  result: 4
regex:
  wordCount: 65
  wordValue: 0.1
  result: 3.48
0.7425.744
I am aware of its purpose. I am proposing to make the config mor…
2.44
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 23
  wordValue: 0.1
  result: 1.44
0.748.032
Will you use array syntax?
1.39
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 5
  wordValue: 0.1
  result: 0.39
0.745.092
This regex appears to convert repeating spaces i.e. `\" \"&#…
4.22
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 19
  wordValue: 0.1
  result: 1.22
0.7415.416
This doesn't seem right. Network ID 1 is mainnet. The RPC clearl…
2.54
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 25
  wordValue: 0.1
  result: 1.54
0.748.312
Seems like not a very useful mock.
1.52
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 7
  wordValue: 0.1
  result: 0.52
0.745.456
Same here
1.18
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 2
  wordValue: 0.1
  result: 0.18
0.744.504
The token address indeed represents DAI on mainnet.
1.59
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 8
  wordValue: 0.1
  result: 0.59
0.745.652
@gentlementlegen rfc
1.18
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 2
  wordValue: 0.1
  result: 0.18
0.744.504
Why not do it in the industry standard way? All values are denom…
4.8
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 30
  wordValue: 0.1
  result: 1.8
0.7417.04
I'm not sure if I understand but task reward is if you completed…
3.35
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 41
  wordValue: 0.1
  result: 2.35
0.7410.58
Spoke a bit on this in dms. @whilefoo my intent with referring t…
8.05
content:
  content:
    p:
      score: 1
      elementCount: 3
  result: 3
regex:
  wordCount: 101
  wordValue: 0.1
  result: 5.05
0.7426.14
Possibly. I personally haven't had that issue but either way my …
2.7
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 28
  wordValue: 0.1
  result: 1.7
0.748.76
I think it's fine. I generally scrutinize test code less than no…
2.06
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 16
  wordValue: 0.1
  result: 1.06
0.746.968
" + "permitUrl": "https://pay.ubq.fi?claim=W3sidHlwZSI6ImVyYzIwLXBlcm1pdCIsInBlcm1pdCI6eyJwZXJtaXR0ZWQiOnsidG9rZW4iOiIweGU5MUQxNTNFMGI0MTUxOEEyQ2U4RGQzRDc5NDRGYTg2MzQ2M2E5N2QiLCJhbW91bnQiOiI1NDMzNTYwMDAwMDAwMDAwMDAwMDAifSwibm9uY2UiOiIzMzkyOTQxNzYyNzkzOTc1NTkzMTc4MTExNTY1OTgzNzk3NDc1ODk0MDM3NDk1NDA0MTMxMjg2MzgyNzgwNDExNjg3NzA4MzUyODg4IiwiZGVhZGxpbmUiOiIxMTU3OTIwODkyMzczMTYxOTU0MjM1NzA5ODUwMDg2ODc5MDc4NTMyNjk5ODQ2NjU2NDA1NjQwMzk0NTc1ODQwMDc5MTMxMjk2Mzk5MzUifSwidHJhbnNmZXJEZXRhaWxzIjp7InRvIjoiMHg0RDA3MDRmNDAwRDU3QmE5M2VFYTg4NzY1QzNGY0RCRDgyNmRDRmM0IiwicmVxdWVzdGVkQW1vdW50IjoiNTQzMzU2MDAwMDAwMDAwMDAwMDAwIn0sIm93bmVyIjoiMHhkOTUzMEYzZmJCRWExMWJlRDAxREMwOUU3OTMxOGYyZjIwMjIzNzE2Iiwic2lnbmF0dXJlIjoiMHhjYTE4NmI2ZDc0ZTI5ODkxMzUxNDVhZmI4NTFhZmI4MjEwZTU1NDlmODljMzgxNDY1NGVjMDEzMDJlODA0NmQxNzkyMDk1YzM2OTY0MGM1Y2JjYjBhMzViOTBmOTk3NzU2MWY5ODczMzJkYmM0ZTI0YTFiMzY4ZGRhYTQ5MWEzYjFiIiwibmV0d29ya0lkIjoxMDB9XQ==", + "evaluationCommentHtml": "

 [ 543.356 WXDAI ] 

@0x4007
⚠️ Your rewards have been limited to the task price of 400 WXDAI.
Contributions Overview
ViewContributionCountReward
ReviewCode Review1515
IssueComment9341.568
ReviewComment23186.788
Review Details
ChangesPriorityReward
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
Conversation Incentives
CommentFormattingRelevancePriorityReward
@whilefoo rfc on how we can deal with comment outputs. Perhaps w…
4.64
content:
  content:
    p:
      score: 1
      elementCount: 1
    pre:
      score: 0
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 47
  wordValue: 0.1
  result: 2.64
0.8414.848
I think you should fork from and overtake that second pull due t…
2.11
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 17
  wordValue: 0.1
  result: 1.11
0.846.752
I think the most pure architecture would be that plugins can NOT…
24.21
content:
  content:
    p:
      score: 1
      elementCount: 7
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 2
  result: 12
regex:
  wordCount: 285
  wordValue: 0.1
  result: 12.21
0.8477.472
I know JSON makes things more complicated than it needs to be wi…
16.43
content:
  content:
    p:
      score: 1
      elementCount: 4
    code:
      score: 1
      elementCount: 4
    a:
      score: 1
      elementCount: 1
  result: 9
regex:
  wordCount: 159
  wordValue: 0.1
  result: 7.43
0.8452.576
Going back to my \"plugin-side-rendering\" mention, the data manip…
13.22
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 5
    pre:
      score: 0
      elementCount: 1
  result: 7
regex:
  wordCount: 129
  wordValue: 0.1
  result: 6.22
0.8442.304
The proposed `comment` output is intended for ease of co…
20.57
content:
  content:
    p:
      score: 1
      elementCount: 6
    code:
      score: 1
      elementCount: 3
    h3:
      score: 1
      elementCount: 1
    pre:
      score: 0
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 11
regex:
  wordCount: 214
  wordValue: 0.1
  result: 9.57
0.8465.824
I understand your concern and I would need to put more thought i…
12.93
content:
  content:
    p:
      score: 1
      elementCount: 5
    code:
      score: 1
      elementCount: 1
    ol:
      score: 0
      elementCount: 1
    li:
      score: 1
      elementCount: 2
  result: 8
regex:
  wordCount: 98
  wordValue: 0.1
  result: 4.93
0.8441.376
I see, so you're suggesting that we must annotate each comment a…
9.88
content:
  content:
    p:
      score: 1
      elementCount: 1
    ol:
      score: 0
      elementCount: 1
    li:
      score: 1
      elementCount: 4
  result: 5
regex:
  wordCount: 97
  wordValue: 0.1
  result: 4.88
0.8431.616
Consider calling it \"contributor\" and \"collaborator\" as that is …
2.75
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 29
  wordValue: 0.1
  result: 1.75
0.848.8
Nice code quality per usual
1.39
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 5
  wordValue: 0.1
  result: 0.39
0.743.892
\"Comment\" implication isn't clear to me
1.52
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 7
  wordValue: 0.1
  result: 0.52
0.744.256
I've always been anti empty string for variable declarations. It…
3.73
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 49
  wordValue: 0.1
  result: 2.73
0.7410.444
Our RPCs don't work anymore
1.46
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 6
  wordValue: 0.1
  result: 0.46
0.744.088
Yes consider changing them to verbs `ISSUER``COMME…
4.7
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 28
  wordValue: 0.1
  result: 1.7
0.7413.16
`[].join(\"\");` yields an empty string as well if there's…
2.94
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 14
  wordValue: 0.1
  result: 0.94
0.748.232
Perhaps it will make the config more expressive if you add other…
3.49
content:
  content:
    p:
      score: 1
      elementCount: 1
    pre:
      score: 0
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 24
  wordValue: 0.1
  result: 1.49
0.749.772
What is this @link syntax
1.39
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 5
  wordValue: 0.1
  result: 0.39
0.743.892
Just noticed the bit wise operators 1337 code
1.59
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 8
  wordValue: 0.1
  result: 0.59
0.744.452
It might seem convoluted but I think that it condenses the logic…
7.48
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 3
    pre:
      score: 0
      elementCount: 1
  result: 4
regex:
  wordCount: 65
  wordValue: 0.1
  result: 3.48
0.7420.944
I am aware of its purpose. I am proposing to make the config mor…
2.44
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 23
  wordValue: 0.1
  result: 1.44
0.746.832
Will you use array syntax?
1.39
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 5
  wordValue: 0.1
  result: 0.39
0.743.892
This regex appears to convert repeating spaces i.e. `\" \"&#…
4.22
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 19
  wordValue: 0.1
  result: 1.22
0.7411.816
This doesn't seem right. Network ID 1 is mainnet. The RPC clearl…
2.54
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 25
  wordValue: 0.1
  result: 1.54
0.747.112
Seems like not a very useful mock.
1.52
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 7
  wordValue: 0.1
  result: 0.52
0.744.256
Same here
1.18
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 2
  wordValue: 0.1
  result: 0.18
0.743.304
The token address indeed represents DAI on mainnet.
1.59
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 8
  wordValue: 0.1
  result: 0.59
0.744.452
@gentlementlegen rfc
1.18
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 2
  wordValue: 0.1
  result: 0.18
0.743.304
Why not do it in the industry standard way? All values are denom…
4.8
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 30
  wordValue: 0.1
  result: 1.8
0.7413.44
I'm not sure if I understand but task reward is if you completed…
3.35
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 41
  wordValue: 0.1
  result: 2.35
0.749.38
Spoke a bit on this in dms. @whilefoo my intent with referring t…
8.05
content:
  content:
    p:
      score: 1
      elementCount: 3
  result: 3
regex:
  wordCount: 101
  wordValue: 0.1
  result: 5.05
0.7422.54
Possibly. I personally haven't had that issue but either way my …
2.7
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 28
  wordValue: 0.1
  result: 1.7
0.747.56
I think it's fine. I generally scrutinize test code less than no…
2.06
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 16
  wordValue: 0.1
  result: 1.06
0.745.768
" }, "whilefoo": { - "total": 74.562, + "total": 67.336, "userId": 139262667, "comments": [ { @@ -1250,7 +1250,7 @@ "url": "https://github.com/ubiquity-os/conversation-rewards/issues/5#issuecomment-2035427134", "type": "ISSUE_CONTRIBUTOR", "score": { - "reward": 15.402, + "reward": 13.6, "formatting": { "content": { "p": { "score": 1, "elementCount": 6 }, @@ -1272,7 +1272,7 @@ "type": "PULL_CONTRIBUTOR", "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);", "score": { - "reward": 2.678, + "reward": 2.072, "formatting": { "content": { "pre": { "score": 0, "elementCount": 1 }, @@ -1294,7 +1294,7 @@ "type": "PULL_CONTRIBUTOR", "diffHunk": "@@ -0,0 +1,41 @@\n+import { parseGitHubUrl } from \"../src/start\";\n+import { IssueActivity } from \"../src/issue-activity\";\n+import { Processor } from \"../src/parser/processor\";\n+import { UserExtractorModule } from \"../src/parser/user-extractor-module\";\n+import { server } from \"./__mocks__/node\";\n+import { DataPurgeModule } from \"../src/parser/data-purge-module\";\n+import userCommentResults from \"./__mocks__/results/user-comment-results.json\";\n+import dataPurgeResults from \"./__mocks__/results/data-purge-result.json\";\n+\n+const issueUrl = process.env.TEST_ISSUE_URL || \"https://github.com/ubiquity-os/comment-incentives/issues/22\";\n+\n+beforeAll(() => server.listen());\n+afterEach(() => server.resetHandlers());\n+afterAll(() => server.close());\n+\n+describe(\"Modules tests\", () => {\n+ const issue = parseGitHubUrl(issueUrl);\n+ const activity = new IssueActivity(issue);\n+\n+ beforeAll(async () => {\n+ await activity.init();\n+ });\n+\n+ it(\"Should extract users from comments\", async () => {\n+ const logSpy = jest.spyOn(console, \"log\");\n+ const processor = new Processor();\n+ processor[\"_transformers\"] = [new UserExtractorModule()];\n+ await processor.run(activity);\n+ processor.dump();\n+ expect(logSpy).toHaveBeenCalledWith(JSON.stringify(userCommentResults, undefined, 2));", "score": { - "reward": 2.098, + "reward": 1.792, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 25, "wordValue": 0.1, "result": 1.54 }, @@ -1309,7 +1309,7 @@ "type": "PULL_CONTRIBUTOR", "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(", "score": { - "reward": 1.507, + "reward": 1.204, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 10, "wordValue": 0.1, "result": 0.71 }, @@ -1324,7 +1324,7 @@ "type": "PULL_CONTRIBUTOR", "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))", "score": { - "reward": 1.616, + "reward": 1.316, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 13, "wordValue": 0.1, "result": 0.88 }, @@ -1339,7 +1339,7 @@ "type": "PULL_CONTRIBUTOR", "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000,", "score": { - "reward": 2.033, + "reward": 1.736, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 24, "wordValue": 0.1, "result": 1.49 }, @@ -1354,7 +1354,7 @@ "type": "PULL_CONTRIBUTOR", "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ function createIncentiveRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function buildIncentiveRow(commentScore: GithubCommentScore) {\n+ // Properly escape carriage returns for HTML rendering\n+ const formatting = stringify(commentScore.score?.formatting?.content).replace(/[\\n\\r]/g, \" \");\n+ return `\n+ \n+ \n+
\n+ ${commentScore.content.replace(/(.{64})..+/, \"$1…\")}\n+
\n+ \n+ \n+
\n+ \n+ ${Object.values(commentScore.score?.formatting?.content || {}).reduce((acc, curr) => {\n+ return acc.add(curr.score * curr.count);\n+ }, new Decimal(0))}\n+ \n+
${formatting}
\n+
\n+ \n+ ${commentScore.score?.relevance || \"-\"}\n+ ${commentScore.score?.reward || \"-\"}\n+ `;\n+ }\n+\n+ for (const issueComment of sorted.issues.comments) {\n+ content.push(buildIncentiveRow(issueComment));\n+ }\n+ for (const reviewComment of sorted.reviews) {\n+ content.push(buildIncentiveRow(reviewComment));\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ return `\n+
\n+ \n+ \n+

\n+ ", "score": { - "reward": 1.896, + "reward": 1.596, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 20, "wordValue": 0.1, "result": 1.28 }, @@ -1369,7 +1369,7 @@ "type": "PULL_CONTRIBUTOR", "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ function createIncentiveRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function buildIncentiveRow(commentScore: GithubCommentScore) {\n+ // Properly escape carriage returns for HTML rendering\n+ const formatting = stringify(commentScore.score?.formatting?.content).replace(/[\\n\\r]/g, \" \");\n+ return `\n+ \n+ \n+
\n+ ${commentScore.content.replace(/(.{64})..+/, \"$1…\")}\n+
\n+ \n+ \n+
\n+ \n+ ${Object.values(commentScore.score?.formatting?.content || {}).reduce((acc, curr) => {\n+ return acc.add(curr.score * curr.count);\n+ }, new Decimal(0))}\n+ \n+
${formatting}
\n+
\n+ \n+ ${commentScore.score?.relevance || \"-\"}\n+ ${commentScore.score?.reward || \"-\"}\n+ `;\n+ }\n+\n+ for (const issueComment of sorted.issues.comments) {\n+ content.push(buildIncentiveRow(issueComment));\n+ }\n+ for (const reviewComment of sorted.reviews) {\n+ content.push(buildIncentiveRow(reviewComment));\n+ }\n+ return content.join(\"\");\n+ }\n+\n+ return `\n+
\n+ \n+ \n+

\n+ ", "score": { - "reward": 1.445, + "reward": 1.148, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 9, "wordValue": 0.1, "result": 0.65 }, @@ -1384,7 +1384,7 @@ "type": "PULL_CONTRIBUTOR", "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000,", "score": { - "reward": 6.386, + "reward": 5.18, "formatting": { "content": { "p": { "score": 1, "elementCount": 3 }, "a": { "score": 1, "elementCount": 1 } }, "result": 4 @@ -1402,7 +1402,7 @@ "type": "PULL_CONTRIBUTOR", "diffHunk": "@@ -0,0 +1,217 @@\n+import { Value } from \"@sinclair/typebox/value\";\n+import Decimal from \"decimal.js\";\n+import * as fs from \"fs\";\n+import { stringify } from \"yaml\";\n+import configuration from \"../configuration/config-reader\";\n+import githubCommentConfig, { GithubCommentConfiguration } from \"../configuration/github-comment-config\";\n+import { getOctokitInstance } from \"../get-authentication-token\";\n+import { CommentType, IssueActivity } from \"../issue-activity\";\n+import { parseGitHubUrl } from \"../start\";\n+import { getPayoutConfigByNetworkId } from \"../types/payout\";\n+import program from \"./command-line\";\n+import { GithubCommentScore, Module, Result } from \"./processor\";\n+\n+/**\n+ * Posts a GitHub comment according to the given results.\n+ */\n+export class GithubCommentModule implements Module {\n+ private readonly _configuration: GithubCommentConfiguration = configuration.githubComment;\n+ private readonly _debugFilePath = \"./output.html\";\n+\n+ async transform(data: Readonly, result: Result): Promise {\n+ const bodyArray: (string | undefined)[] = [];\n+\n+ for (const [key, value] of Object.entries(result)) {\n+ result[key].evaluationCommentHtml = this._generateHtml(key, value);\n+ bodyArray.push(result[key].evaluationCommentHtml);\n+ }\n+ const body = bodyArray.join(\"\");\n+ if (this._configuration.debug) {\n+ fs.writeFileSync(this._debugFilePath, body);\n+ }\n+ if (this._configuration.post) {\n+ try {\n+ const octokit = getOctokitInstance();\n+ const { owner, repo, issue_number } = parseGitHubUrl(program.opts().issue);\n+\n+ await octokit.issues.createComment({\n+ body,\n+ repo,\n+ owner,\n+ issue_number,\n+ });\n+ } catch (e) {\n+ console.error(`Could not post GitHub comment: ${e}`);\n+ }\n+ }\n+ return Promise.resolve(result);\n+ }\n+\n+ get enabled(): boolean {\n+ if (!Value.Check(githubCommentConfig, this._configuration)) {\n+ console.warn(\"Invalid configuration detected for GithubContentModule, disabling.\");\n+ return false;\n+ }\n+ return true;\n+ }\n+\n+ _generateHtml(username: string, result: Result[0]) {\n+ const sorted = result.comments?.reduce<{\n+ issues: { task: GithubCommentScore | null; comments: GithubCommentScore[] };\n+ reviews: GithubCommentScore[];\n+ }>(\n+ (acc, curr) => {\n+ if (curr.type & CommentType.ISSUE) {\n+ if (curr.type & CommentType.TASK) {\n+ acc.issues.task = curr;\n+ } else {\n+ acc.issues.comments.push(curr);\n+ }\n+ } else if (curr.type & CommentType.REVIEW) {\n+ acc.reviews.push(curr);\n+ }\n+ return acc;\n+ },\n+ { issues: { task: null, comments: [] }, reviews: [] }\n+ );\n+\n+ function createContributionRows() {\n+ const content: string[] = [];\n+\n+ if (!sorted) {\n+ return content.join(\"\");\n+ }\n+\n+ function generateContributionRow(\n+ view: string,\n+ contribution: string,\n+ count: number,\n+ reward: number | Decimal | undefined\n+ ) {\n+ return `\n+ \n+ ${view}\n+ ${contribution}\n+ ${count}\n+ ${reward || \"-\"}\n+ `;\n+ }\n+\n+ if (result.task?.reward) {\n+ content.push(generateContributionRow(\"Issue\", \"Task\", 1, result.task.reward));\n+ }\n+ if (sorted.issues.task) {\n+ content.push(generateContributionRow(\"Issue\", \"Specification\", 1, sorted.issues.task.score?.reward));\n+ }\n+ if (sorted.issues.comments.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Issue\",\n+ \"Comment\",\n+ sorted.issues.comments.length,\n+ sorted.issues.comments.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))\n+ )\n+ );\n+ }\n+ if (sorted.reviews.length) {\n+ content.push(\n+ generateContributionRow(\n+ \"Review\",\n+ \"Comment\",\n+ sorted.reviews.length,\n+ sorted.reviews.reduce((acc, curr) => acc.add(curr.score?.reward ?? 0), new Decimal(0))", "score": { - "reward": 1.787, + "reward": 1.484, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 17, "wordValue": 0.1, "result": 1.11 }, @@ -1417,7 +1417,7 @@ "type": "PULL_CONTRIBUTOR", "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000,", "score": { - "reward": 5.49, + "reward": 4.284, "formatting": { "content": { "p": { "score": 1, "elementCount": 2 }, "code": { "score": 1, "elementCount": 2 } }, "result": 4 @@ -1435,7 +1435,7 @@ "type": "PULL_CONTRIBUTOR", "diffHunk": "@@ -19,12 +19,42 @@ import {\n } from \"./start\";\n \n export enum CommentType {\n+ /**\n+ * Review related item\n+ */\n REVIEW = 0b1,\n+ /**\n+ * Issue related item\n+ */\n ISSUE = 0b10,\n+ /**\n+ * User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ASSIGNEE = 0b100,\n+ /**\n+ * The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n ISSUER = 0b1000,\n+ /**\n+ * A user that is part of the organization or owner of the repo\n+ */\n COLLABORATOR = 0b10000,\n+ /**\n+ * A user that is NOT part of the organization nor owner of the repo\n+ */\n CONTRIBUTOR = 0b100000,\n+ /**\n+ * A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW}\n+ */\n+ COMMENTED = 0b1000000,\n+ /**\n+ * Pull request opening item\n+ */\n+ TASK = 0b10000000,", "score": { - "reward": 1.224, + "reward": 0.924, "formatting": { "content": { "p": { "score": 1, "elementCount": 1 } }, "result": 1 }, "priority": 4, "words": { "wordCount": 4, "wordValue": 0.1, "result": 0.32 }, @@ -1455,6 +1455,6 @@ { "reviewId": 2022648888, "effect": { "addition": 50, "deletion": 50 }, "reward": 1, "priority": 1 } ] }, - "evaluationCommentHtml": "

 [ 74.562 WXDAI ] 

@whilefoo
Contributions Overview
ViewContributionCountReward
ReviewBase Review125
ReviewCode Review66
IssueComment115.402
ReviewComment1128.16
Review Details
ChangesPriorityReward
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
Conversation Incentives
CommentFormattingRelevancePriorityReward
there are a couple of options:1. we let the conversation-rewar…
16.99
content:
  content:
    p:
      score: 1
      elementCount: 6
    ol:
      score: 0
      elementCount: 1
    li:
      score: 1
      elementCount: 3
  result: 9
regex:
  wordCount: 173
  wordValue: 0.1
  result: 7.99
0.8415.402
```suggestionreturn result;```…
2.94
content:
  content:
    pre:
      score: 0
      elementCount: 1
    code:
      score: 1
      elementCount: 1
    p:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 14
  wordValue: 0.1
  result: 0.94
0.742.678
I'm not sure if it's a good idea to rely on logs for testing, is…
2.54
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 25
  wordValue: 0.1
  result: 1.54
0.742.098
why so many nested functions? it becomes hard to read
1.71
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 10
  wordValue: 0.1
  result: 0.71
0.741.507
is there a reason we are using Decimal.js instead of native BigI…
1.88
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 13
  wordValue: 0.1
  result: 0.88
0.741.616
Shouldn't task be issue opening item and specification is pull r…
2.49
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 24
  wordValue: 0.1
  result: 1.49
0.742.033
I assume this is a permit for task assignee, but where are other…
2.28
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 20
  wordValue: 0.1
  result: 1.28
0.741.896
gotcha, I thought this html is for all users
1.65
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 9
  wordValue: 0.1
  result: 0.65
0.741.445
I can see from the example that it works correctly but when read…
7.38
content:
  content:
    p:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 4
regex:
  wordCount: 63
  wordValue: 0.1
  result: 3.38
0.746.386
Ok so we need it for precise floating point calculations, in tha…
2.11
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 17
  wordValue: 0.1
  result: 1.11
0.741.787
why is it `ISSUER` which is meant for author of issue/re…
6.1
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 2
  result: 4
regex:
  wordCount: 36
  wordValue: 0.1
  result: 2.1
0.745.49
this makes more sense!
1.32
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 4
  wordValue: 0.1
  result: 0.32
0.741.224
" + "evaluationCommentHtml": "

 [ 67.336 WXDAI ] 

@whilefoo
Contributions Overview
ViewContributionCountReward
ReviewBase Review125
ReviewCode Review66
IssueComment113.6
ReviewComment1122.736
Review Details
ChangesPriorityReward
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
Conversation Incentives
CommentFormattingRelevancePriorityReward
there are a couple of options:1. we let the conversation-rewar…
16.99
content:
  content:
    p:
      score: 1
      elementCount: 6
    ol:
      score: 0
      elementCount: 1
    li:
      score: 1
      elementCount: 3
  result: 9
regex:
  wordCount: 173
  wordValue: 0.1
  result: 7.99
0.8413.6
```suggestionreturn result;```…
2.94
content:
  content:
    pre:
      score: 0
      elementCount: 1
    code:
      score: 1
      elementCount: 1
    p:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 14
  wordValue: 0.1
  result: 0.94
0.742.072
I'm not sure if it's a good idea to rely on logs for testing, is…
2.54
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 25
  wordValue: 0.1
  result: 1.54
0.741.792
why so many nested functions? it becomes hard to read
1.71
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 10
  wordValue: 0.1
  result: 0.71
0.741.204
is there a reason we are using Decimal.js instead of native BigI…
1.88
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 13
  wordValue: 0.1
  result: 0.88
0.741.316
Shouldn't task be issue opening item and specification is pull r…
2.49
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 24
  wordValue: 0.1
  result: 1.49
0.741.736
I assume this is a permit for task assignee, but where are other…
2.28
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 20
  wordValue: 0.1
  result: 1.28
0.741.596
gotcha, I thought this html is for all users
1.65
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 9
  wordValue: 0.1
  result: 0.65
0.741.148
I can see from the example that it works correctly but when read…
7.38
content:
  content:
    p:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 4
regex:
  wordCount: 63
  wordValue: 0.1
  result: 3.38
0.745.18
Ok so we need it for precise floating point calculations, in tha…
2.11
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 17
  wordValue: 0.1
  result: 1.11
0.741.484
why is it `ISSUER` which is meant for author of issue/re…
6.1
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 2
  result: 4
regex:
  wordCount: 36
  wordValue: 0.1
  result: 2.1
0.744.284
this makes more sense!
1.32
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 4
  wordValue: 0.1
  result: 0.32
0.740.924
" } } diff --git a/tests/__mocks__/results/output.html b/tests/__mocks__/results/output.html index d0e11e3e..0fec66ed 100644 --- a/tests/__mocks__/results/output.html +++ b/tests/__mocks__/results/output.html @@ -1,4 +1,4 @@ -

 [ 2123.088 WXDAI ] 

@gentlementlegen
⚠️ Your rewards have been limited to the task price of 400 WXDAI.
Contributions Overview
ViewContributionCountReward
IssueTask1400
ReviewCode Review2121
IssueSpecification161.8
IssueComment9457.088
ReviewComment251183.2
Review Details
ChangesPriorityReward
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
Conversation Incentives
CommentFormattingRelevancePriorityReward
In the v1 of the Ubiquibot, when a result gets evaluated, a reca…
15.45
content:
  content:
    p:
      score: 1
      elementCount: 6
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 11
regex:
  wordCount: 87
  wordValue: 0.1
  result: 4.45
1461.8
This needs https://github.com/ubiquity-os/conversation-rewards/p…
5.22
content:
  content:
    p:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 17
  wordValue: 0.2
  result: 2.22
0.8419.104
To me 1 is the most straightforward to do for few reasons:- th…
20.36
content:
  content:
    p:
      score: 1
      elementCount: 5
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 10
regex:
  wordCount: 104
  wordValue: 0.2
  result: 10.36
0.8473.152
I think each plugin should output JSON not html as it is not rel…
17.53
content:
  content:
    p:
      score: 1
      elementCount: 3
    code:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 7
regex:
  wordCount: 106
  wordValue: 0.2
  result: 10.53
0.8461.696
If you want to manipulate and convey data, HTML really is not ma…
17.85
content:
  content:
    p:
      score: 1
      elementCount: 4
    a:
      score: 1
      elementCount: 1
  result: 5
regex:
  wordCount: 134
  wordValue: 0.2
  result: 12.85
0.8461.12
But then how do we consider the formatting of that output?Prac…
19.87
content:
  content:
    p:
      score: 1
      elementCount: 5
  result: 5
regex:
  wordCount: 159
  wordValue: 0.2
  result: 14.87
0.8467.584
This can work, but we skyrocket coupling and to me defeat purpos…
7.03
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 55
  wordValue: 0.2
  result: 6.03
0.8423.296
@pavlovcik To mitigate that that's why inside the comment reward…
10.73
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 85
  wordValue: 0.2
  result: 8.73
0.8435.936
I realized that to carry this task properly we need to handle fl…
9.31
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 58
  wordValue: 0.2
  result: 6.31
0.8432.192
Agreed, I think currently there are 3 possible things to annotat…
21.94
content:
  content:
    p:
      score: 1
      elementCount: 5
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 3
    code:
      score: 1
      elementCount: 7
  result: 16
regex:
  wordCount: 54
  wordValue: 0.2
  result: 5.94
0.8483.008
Resolves #5 Depends on #8 Reviews looks gigantic but it's on…
3
content:
  content:
    p:
      score: 1
      elementCount: 3
  result: 3
regex:
  wordCount: 19
  wordValue: 0
  result: 0
0.740
I think in this case it makes sense because this function will r…
12.49
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 4
  result: 6
regex:
  wordCount: 60
  wordValue: 0.2
  result: 6.49
0.7484.344
It is supposed to represent a comment. Would you prefer a descri…
4.11
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 16
  wordValue: 0.2
  result: 2.11
0.7427.816
True, just picked this up from the previous codebase. https://rp…
4
content:
  content:
    p:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 15
  wordValue: 0.2
  result: 2
0.7427.2
Seems convoluted to me and I don't know what problem that solved…
7.6
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 40
  wordValue: 0.2
  result: 4.6
0.7449.76
Changed `COMMENT` to `COMMENTED`, added jsdoc de…
6.42
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 5
regex:
  wordCount: 10
  wordValue: 0.2
  result: 1.42
0.7447.952
Simply makes the docs linking the code within the comment, for c…
8.01
content:
  content:
    p:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 4
regex:
  wordCount: 34
  wordValue: 0.2
  result: 4.01
0.7454.456
In the case of a string it would coerce the value and you would …
4.09
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 25
  wordValue: 0.2
  result: 3.09
0.7425.304
`observe` would help to chose what we want to include an…
7.7
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 41
  wordValue: 0.2
  result: 4.7
0.7450.32
Not very useful indeed. I am working on the tests on a separate …
6.4
content:
  content:
    p:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 28
  wordValue: 0.2
  result: 3.4
0.7443.04
See https://github.com/ubiquity-os/conversation-rewards/pull/14 …
3.17
content:
  content:
    p:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 8
  wordValue: 0.2
  result: 1.17
0.7422.552
Good point, also symbol should not be DAI but ETH isn't it? …
8.5
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 4
regex:
  wordCount: 39
  wordValue: 0.2
  result: 4.5
0.7457.2
Had changed it everywhere else but here, now it should be fine
2.65
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 12
  wordValue: 0.2
  result: 1.65
0.7417.24
This matches any whitespace character (spaces, tabs, line breaks…
4.91
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 33
  wordValue: 0.2
  result: 3.91
0.7429.896
By definition `dump` was just outputting results to stdo…
9.22
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 68
  wordValue: 0.2
  result: 7.22
0.7456.432
Un-nested them one level. I think that the `buildXrow` s…
5.09
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 25
  wordValue: 0.2
  result: 3.09
0.7433.304
I assumed BigInt only handles integers, and we manipulate a lot …
3.98
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 24
  wordValue: 0.2
  result: 2.98
0.7424.688
There is one permit generated per participating user, last run:…
4.42
content:
  content:
    p:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 10
  wordValue: 0.2
  result: 1.42
0.7431.952
I made it according to the previous version:- Issue Specificat…
12.7
content:
  content:
    p:
      score: 1
      elementCount: 5
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 9
regex:
  wordCount: 31
  wordValue: 0.2
  result: 3.7
0.7492.72
Wouldn't that lead to precision loss in JS and after the divisio…
5.6
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 30
  wordValue: 0.2
  result: 3.6
0.7436.16
That is correct. I understand now why you're confused:The valu…
21.95
content:
  content:
    p:
      score: 1
      elementCount: 8
    code:
      score: 1
      elementCount: 7
  result: 15
regex:
  wordCount: 65
  wordValue: 0.2
  result: 6.95
0.74158.92
I don't think is it relevant in this scenario because we are not…
6.37
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 48
  wordValue: 0.2
  result: 5.37
0.7438.072
@whilefoo you are correct, these were wrongly used. I corrected …
16.28
content:
  content:
    p:
      score: 1
      elementCount: 5
    code:
      score: 1
      elementCount: 5
    a:
      score: 1
      elementCount: 1
  result: 11
regex:
  wordCount: 47
  wordValue: 0.2
  result: 5.28
0.74117.568
Example of successful comment posting with results:https://git…
4.05
content:
  content:
    p:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 7
  wordValue: 0.2
  result: 1.05
0.7429.88
@0x4007 I believe that if I had all the tests in this PR it will…
4.29
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 27
  wordValue: 0.2
  result: 3.29
0.7426.424

 [ 631.356 WXDAI ] 

@0x4007
⚠️ Your rewards have been limited to the task price of 400 WXDAI.
Contributions Overview
ViewContributionCountReward
ReviewCode Review1515
IssueComment9386.368
ReviewComment23229.988
Review Details
ChangesPriorityReward
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
Conversation Incentives
CommentFormattingRelevancePriorityReward
@whilefoo rfc on how we can deal with comment outputs. Perhaps w…
4.64
content:
  content:
    p:
      score: 1
      elementCount: 1
    pre:
      score: 0
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 47
  wordValue: 0.1
  result: 2.64
0.8416.448
I think you should fork from and overtake that second pull due t…
2.11
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 17
  wordValue: 0.1
  result: 1.11
0.847.552
I think the most pure architecture would be that plugins can NOT…
24.21
content:
  content:
    p:
      score: 1
      elementCount: 7
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 2
  result: 12
regex:
  wordCount: 285
  wordValue: 0.1
  result: 12.21
0.8487.072
I know JSON makes things more complicated than it needs to be wi…
16.43
content:
  content:
    p:
      score: 1
      elementCount: 4
    code:
      score: 1
      elementCount: 4
    a:
      score: 1
      elementCount: 1
  result: 9
regex:
  wordCount: 159
  wordValue: 0.1
  result: 7.43
0.8459.776
Going back to my "plugin-side-rendering" mention, the data manip…
13.22
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 5
    pre:
      score: 0
      elementCount: 1
  result: 7
regex:
  wordCount: 129
  wordValue: 0.1
  result: 6.22
0.8447.904
The proposed `comment` output is intended for ease of co…
20.57
content:
  content:
    p:
      score: 1
      elementCount: 6
    code:
      score: 1
      elementCount: 3
    h3:
      score: 1
      elementCount: 1
    pre:
      score: 0
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 11
regex:
  wordCount: 214
  wordValue: 0.1
  result: 9.57
0.8474.624
I understand your concern and I would need to put more thought i…
12.93
content:
  content:
    p:
      score: 1
      elementCount: 5
    code:
      score: 1
      elementCount: 1
    ol:
      score: 0
      elementCount: 1
    li:
      score: 1
      elementCount: 2
  result: 8
regex:
  wordCount: 98
  wordValue: 0.1
  result: 4.93
0.8447.776
I see, so you're suggesting that we must annotate each comment a…
9.88
content:
  content:
    p:
      score: 1
      elementCount: 1
    ol:
      score: 0
      elementCount: 1
    li:
      score: 1
      elementCount: 4
  result: 5
regex:
  wordCount: 97
  wordValue: 0.1
  result: 4.88
0.8435.616
Consider calling it "contributor" and "collaborator" as that is …
2.75
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 29
  wordValue: 0.1
  result: 1.75
0.849.6
Nice code quality per usual
1.39
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 5
  wordValue: 0.1
  result: 0.39
0.745.092
"Comment" implication isn't clear to me
1.52
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 7
  wordValue: 0.1
  result: 0.52
0.745.456
I've always been anti empty string for variable declarations. It…
3.73
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 49
  wordValue: 0.1
  result: 2.73
0.7411.644
Our RPCs don't work anymore
1.46
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 6
  wordValue: 0.1
  result: 0.46
0.745.288
Yes consider changing them to verbs `ISSUER``COMME…
4.7
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 28
  wordValue: 0.1
  result: 1.7
0.7416.76
`[].join("");` yields an empty string as well if there's…
2.94
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 14
  wordValue: 0.1
  result: 0.94
0.7410.632
Perhaps it will make the config more expressive if you add other…
3.49
content:
  content:
    p:
      score: 1
      elementCount: 1
    pre:
      score: 0
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 24
  wordValue: 0.1
  result: 1.49
0.7412.172
What is this @link syntax
1.39
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 5
  wordValue: 0.1
  result: 0.39
0.745.092
Just noticed the bit wise operators 1337 code
1.59
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 8
  wordValue: 0.1
  result: 0.59
0.745.652
It might seem convoluted but I think that it condenses the logic…
7.48
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 3
    pre:
      score: 0
      elementCount: 1
  result: 4
regex:
  wordCount: 65
  wordValue: 0.1
  result: 3.48
0.7425.744
I am aware of its purpose. I am proposing to make the config mor…
2.44
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 23
  wordValue: 0.1
  result: 1.44
0.748.032
Will you use array syntax?
1.39
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 5
  wordValue: 0.1
  result: 0.39
0.745.092
This regex appears to convert repeating spaces i.e. `" "&#…
4.22
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 19
  wordValue: 0.1
  result: 1.22
0.7415.416
This doesn't seem right. Network ID 1 is mainnet. The RPC clearl…
2.54
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 25
  wordValue: 0.1
  result: 1.54
0.748.312
Seems like not a very useful mock.
1.52
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 7
  wordValue: 0.1
  result: 0.52
0.745.456
Same here
1.18
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 2
  wordValue: 0.1
  result: 0.18
0.744.504
The token address indeed represents DAI on mainnet.
1.59
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 8
  wordValue: 0.1
  result: 0.59
0.745.652
@gentlementlegen rfc
1.18
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 2
  wordValue: 0.1
  result: 0.18
0.744.504
Why not do it in the industry standard way? All values are denom…
4.8
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 30
  wordValue: 0.1
  result: 1.8
0.7417.04
I'm not sure if I understand but task reward is if you completed…
3.35
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 41
  wordValue: 0.1
  result: 2.35
0.7410.58
Spoke a bit on this in dms. @whilefoo my intent with referring t…
8.05
content:
  content:
    p:
      score: 1
      elementCount: 3
  result: 3
regex:
  wordCount: 101
  wordValue: 0.1
  result: 5.05
0.7426.14
Possibly. I personally haven't had that issue but either way my …
2.7
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 28
  wordValue: 0.1
  result: 1.7
0.748.76
I think it's fine. I generally scrutinize test code less than no…
2.06
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 16
  wordValue: 0.1
  result: 1.06
0.746.968

 [ 74.562 WXDAI ] 

@whilefoo
Contributions Overview
ViewContributionCountReward
ReviewBase Review125
ReviewCode Review66
IssueComment115.402
ReviewComment1128.16
Review Details
ChangesPriorityReward
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
Conversation Incentives
CommentFormattingRelevancePriorityReward
there are a couple of options:1. we let the conversation-rewar…
16.99
content:
  content:
    p:
      score: 1
      elementCount: 6
    ol:
      score: 0
      elementCount: 1
    li:
      score: 1
      elementCount: 3
  result: 9
regex:
  wordCount: 173
  wordValue: 0.1
  result: 7.99
0.8415.402
```suggestionreturn result;```…
2.94
content:
  content:
    pre:
      score: 0
      elementCount: 1
    code:
      score: 1
      elementCount: 1
    p:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 14
  wordValue: 0.1
  result: 0.94
0.742.678
I'm not sure if it's a good idea to rely on logs for testing, is…
2.54
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 25
  wordValue: 0.1
  result: 1.54
0.742.098
why so many nested functions? it becomes hard to read
1.71
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 10
  wordValue: 0.1
  result: 0.71
0.741.507
is there a reason we are using Decimal.js instead of native BigI…
1.88
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 13
  wordValue: 0.1
  result: 0.88
0.741.616
Shouldn't task be issue opening item and specification is pull r…
2.49
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 24
  wordValue: 0.1
  result: 1.49
0.742.033
I assume this is a permit for task assignee, but where are other…
2.28
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 20
  wordValue: 0.1
  result: 1.28
0.741.896
gotcha, I thought this html is for all users
1.65
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 9
  wordValue: 0.1
  result: 0.65
0.741.445
I can see from the example that it works correctly but when read…
7.38
content:
  content:
    p:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 4
regex:
  wordCount: 63
  wordValue: 0.1
  result: 3.38
0.746.386
Ok so we need it for precise floating point calculations, in tha…
2.11
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 17
  wordValue: 0.1
  result: 1.11
0.741.787
why is it `ISSUER` which is meant for author of issue/re…
6.1
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 2
  result: 4
regex:
  wordCount: 36
  wordValue: 0.1
  result: 2.1
0.745.49
this makes more sense!
1.32
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 4
  wordValue: 0.1
  result: 0.32
0.741.224
+

 [ 1872.688 WXDAI ] 

@gentlementlegen
⚠️ Your rewards have been limited to the task price of 400 WXDAI.
Contributions Overview
ViewContributionCountReward
IssueTask1400
ReviewCode Review2121
IssueSpecification161.8
IssueComment9415.488
ReviewComment25974.4
Review Details
ChangesPriorityReward
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
Conversation Incentives
CommentFormattingRelevancePriorityReward
In the v1 of the Ubiquibot, when a result gets evaluated, a reca…
15.45
content:
  content:
    p:
      score: 1
      elementCount: 6
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 11
regex:
  wordCount: 87
  wordValue: 0.1
  result: 4.45
1461.8
This needs https://github.com/ubiquity-os/conversation-rewards/p…
5.22
content:
  content:
    p:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 17
  wordValue: 0.2
  result: 2.22
0.8416.704
To me 1 is the most straightforward to do for few reasons:- th…
20.36
content:
  content:
    p:
      score: 1
      elementCount: 5
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 10
regex:
  wordCount: 104
  wordValue: 0.2
  result: 10.36
0.8465.152
I think each plugin should output JSON not html as it is not rel…
17.53
content:
  content:
    p:
      score: 1
      elementCount: 3
    code:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 7
regex:
  wordCount: 106
  wordValue: 0.2
  result: 10.53
0.8456.096
If you want to manipulate and convey data, HTML really is not ma…
17.85
content:
  content:
    p:
      score: 1
      elementCount: 4
    a:
      score: 1
      elementCount: 1
  result: 5
regex:
  wordCount: 134
  wordValue: 0.2
  result: 12.85
0.8457.12
But then how do we consider the formatting of that output?Prac…
19.87
content:
  content:
    p:
      score: 1
      elementCount: 5
  result: 5
regex:
  wordCount: 159
  wordValue: 0.2
  result: 14.87
0.8463.584
This can work, but we skyrocket coupling and to me defeat purpos…
7.03
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 55
  wordValue: 0.2
  result: 6.03
0.8422.496
@pavlovcik To mitigate that that's why inside the comment reward…
10.73
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 85
  wordValue: 0.2
  result: 8.73
0.8434.336
I realized that to carry this task properly we need to handle fl…
9.31
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 58
  wordValue: 0.2
  result: 6.31
0.8429.792
Agreed, I think currently there are 3 possible things to annotat…
21.94
content:
  content:
    p:
      score: 1
      elementCount: 5
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 3
    code:
      score: 1
      elementCount: 7
  result: 16
regex:
  wordCount: 54
  wordValue: 0.2
  result: 5.94
0.8470.208
Resolves #5 Depends on #8 Reviews looks gigantic but it's on…
3
content:
  content:
    p:
      score: 1
      elementCount: 3
  result: 3
regex:
  wordCount: 19
  wordValue: 0
  result: 0
0.740
I think in this case it makes sense because this function will r…
12.49
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 4
  result: 6
regex:
  wordCount: 60
  wordValue: 0.2
  result: 6.49
0.7469.944
It is supposed to represent a comment. Would you prefer a descri…
4.11
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 16
  wordValue: 0.2
  result: 2.11
0.7423.016
True, just picked this up from the previous codebase. https://rp…
4
content:
  content:
    p:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 15
  wordValue: 0.2
  result: 2
0.7422.4
Seems convoluted to me and I don't know what problem that solved…
7.6
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 40
  wordValue: 0.2
  result: 4.6
0.7442.56
Changed `COMMENT` to `COMMENTED`, added jsdoc de…
6.42
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 5
regex:
  wordCount: 10
  wordValue: 0.2
  result: 1.42
0.7435.952
Simply makes the docs linking the code within the comment, for c…
8.01
content:
  content:
    p:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 4
regex:
  wordCount: 34
  wordValue: 0.2
  result: 4.01
0.7444.856
In the case of a string it would coerce the value and you would …
4.09
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 25
  wordValue: 0.2
  result: 3.09
0.7422.904
`observe` would help to chose what we want to include an…
7.7
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 41
  wordValue: 0.2
  result: 4.7
0.7443.12
Not very useful indeed. I am working on the tests on a separate …
6.4
content:
  content:
    p:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 28
  wordValue: 0.2
  result: 3.4
0.7435.84
See https://github.com/ubiquity-os/conversation-rewards/pull/14 …
3.17
content:
  content:
    p:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 8
  wordValue: 0.2
  result: 1.17
0.7417.752
Good point, also symbol should not be DAI but ETH isn't it? …
8.5
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 4
regex:
  wordCount: 39
  wordValue: 0.2
  result: 4.5
0.7447.6
Had changed it everywhere else but here, now it should be fine
2.65
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 12
  wordValue: 0.2
  result: 1.65
0.7414.84
This matches any whitespace character (spaces, tabs, line breaks…
4.91
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 33
  wordValue: 0.2
  result: 3.91
0.7427.496
By definition `dump` was just outputting results to stdo…
9.22
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 68
  wordValue: 0.2
  result: 7.22
0.7451.632
Un-nested them one level. I think that the `buildXrow` s…
5.09
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 25
  wordValue: 0.2
  result: 3.09
0.7428.504
I assumed BigInt only handles integers, and we manipulate a lot …
3.98
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 24
  wordValue: 0.2
  result: 2.98
0.7422.288
There is one permit generated per participating user, last run:…
4.42
content:
  content:
    p:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 10
  wordValue: 0.2
  result: 1.42
0.7424.752
I made it according to the previous version:- Issue Specificat…
12.7
content:
  content:
    p:
      score: 1
      elementCount: 5
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 9
regex:
  wordCount: 31
  wordValue: 0.2
  result: 3.7
0.7471.12
Wouldn't that lead to precision loss in JS and after the divisio…
5.6
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 30
  wordValue: 0.2
  result: 3.6
0.7431.36
That is correct. I understand now why you're confused:The valu…
21.95
content:
  content:
    p:
      score: 1
      elementCount: 8
    code:
      score: 1
      elementCount: 7
  result: 15
regex:
  wordCount: 65
  wordValue: 0.2
  result: 6.95
0.74122.92
I don't think is it relevant in this scenario because we are not…
6.37
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 48
  wordValue: 0.2
  result: 5.37
0.7435.672
@whilefoo you are correct, these were wrongly used. I corrected …
16.28
content:
  content:
    p:
      score: 1
      elementCount: 5
    code:
      score: 1
      elementCount: 5
    a:
      score: 1
      elementCount: 1
  result: 11
regex:
  wordCount: 47
  wordValue: 0.2
  result: 5.28
0.7491.168
Example of successful comment posting with results:https://git…
4.05
content:
  content:
    p:
      score: 1
      elementCount: 2
    a:
      score: 1
      elementCount: 1
  result: 3
regex:
  wordCount: 7
  wordValue: 0.2
  result: 1.05
0.7422.68
@0x4007 I believe that if I had all the tests in this PR it will…
4.29
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 27
  wordValue: 0.2
  result: 3.29
0.7424.024

 [ 543.356 WXDAI ] 

@0x4007
⚠️ Your rewards have been limited to the task price of 400 WXDAI.
Contributions Overview
ViewContributionCountReward
ReviewCode Review1515
IssueComment9341.568
ReviewComment23186.788
Review Details
ChangesPriorityReward
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
Conversation Incentives
CommentFormattingRelevancePriorityReward
@whilefoo rfc on how we can deal with comment outputs. Perhaps w…
4.64
content:
  content:
    p:
      score: 1
      elementCount: 1
    pre:
      score: 0
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 47
  wordValue: 0.1
  result: 2.64
0.8414.848
I think you should fork from and overtake that second pull due t…
2.11
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 17
  wordValue: 0.1
  result: 1.11
0.846.752
I think the most pure architecture would be that plugins can NOT…
24.21
content:
  content:
    p:
      score: 1
      elementCount: 7
    ul:
      score: 1
      elementCount: 1
    li:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 2
  result: 12
regex:
  wordCount: 285
  wordValue: 0.1
  result: 12.21
0.8477.472
I know JSON makes things more complicated than it needs to be wi…
16.43
content:
  content:
    p:
      score: 1
      elementCount: 4
    code:
      score: 1
      elementCount: 4
    a:
      score: 1
      elementCount: 1
  result: 9
regex:
  wordCount: 159
  wordValue: 0.1
  result: 7.43
0.8452.576
Going back to my "plugin-side-rendering" mention, the data manip…
13.22
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 5
    pre:
      score: 0
      elementCount: 1
  result: 7
regex:
  wordCount: 129
  wordValue: 0.1
  result: 6.22
0.8442.304
The proposed `comment` output is intended for ease of co…
20.57
content:
  content:
    p:
      score: 1
      elementCount: 6
    code:
      score: 1
      elementCount: 3
    h3:
      score: 1
      elementCount: 1
    pre:
      score: 0
      elementCount: 1
    a:
      score: 1
      elementCount: 1
  result: 11
regex:
  wordCount: 214
  wordValue: 0.1
  result: 9.57
0.8465.824
I understand your concern and I would need to put more thought i…
12.93
content:
  content:
    p:
      score: 1
      elementCount: 5
    code:
      score: 1
      elementCount: 1
    ol:
      score: 0
      elementCount: 1
    li:
      score: 1
      elementCount: 2
  result: 8
regex:
  wordCount: 98
  wordValue: 0.1
  result: 4.93
0.8441.376
I see, so you're suggesting that we must annotate each comment a…
9.88
content:
  content:
    p:
      score: 1
      elementCount: 1
    ol:
      score: 0
      elementCount: 1
    li:
      score: 1
      elementCount: 4
  result: 5
regex:
  wordCount: 97
  wordValue: 0.1
  result: 4.88
0.8431.616
Consider calling it "contributor" and "collaborator" as that is …
2.75
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 29
  wordValue: 0.1
  result: 1.75
0.848.8
Nice code quality per usual
1.39
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 5
  wordValue: 0.1
  result: 0.39
0.743.892
"Comment" implication isn't clear to me
1.52
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 7
  wordValue: 0.1
  result: 0.52
0.744.256
I've always been anti empty string for variable declarations. It…
3.73
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 49
  wordValue: 0.1
  result: 2.73
0.7410.444
Our RPCs don't work anymore
1.46
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 6
  wordValue: 0.1
  result: 0.46
0.744.088
Yes consider changing them to verbs `ISSUER``COMME…
4.7
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 28
  wordValue: 0.1
  result: 1.7
0.7413.16
`[].join("");` yields an empty string as well if there's…
2.94
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 14
  wordValue: 0.1
  result: 0.94
0.748.232
Perhaps it will make the config more expressive if you add other…
3.49
content:
  content:
    p:
      score: 1
      elementCount: 1
    pre:
      score: 0
      elementCount: 1
    code:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 24
  wordValue: 0.1
  result: 1.49
0.749.772
What is this @link syntax
1.39
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 5
  wordValue: 0.1
  result: 0.39
0.743.892
Just noticed the bit wise operators 1337 code
1.59
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 8
  wordValue: 0.1
  result: 0.59
0.744.452
It might seem convoluted but I think that it condenses the logic…
7.48
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 3
    pre:
      score: 0
      elementCount: 1
  result: 4
regex:
  wordCount: 65
  wordValue: 0.1
  result: 3.48
0.7420.944
I am aware of its purpose. I am proposing to make the config mor…
2.44
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 23
  wordValue: 0.1
  result: 1.44
0.746.832
Will you use array syntax?
1.39
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 5
  wordValue: 0.1
  result: 0.39
0.743.892
This regex appears to convert repeating spaces i.e. `" "&#…
4.22
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 19
  wordValue: 0.1
  result: 1.22
0.7411.816
This doesn't seem right. Network ID 1 is mainnet. The RPC clearl…
2.54
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 25
  wordValue: 0.1
  result: 1.54
0.747.112
Seems like not a very useful mock.
1.52
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 7
  wordValue: 0.1
  result: 0.52
0.744.256
Same here
1.18
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 2
  wordValue: 0.1
  result: 0.18
0.743.304
The token address indeed represents DAI on mainnet.
1.59
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 8
  wordValue: 0.1
  result: 0.59
0.744.452
@gentlementlegen rfc
1.18
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 2
  wordValue: 0.1
  result: 0.18
0.743.304
Why not do it in the industry standard way? All values are denom…
4.8
content:
  content:
    p:
      score: 1
      elementCount: 1
    code:
      score: 1
      elementCount: 2
  result: 3
regex:
  wordCount: 30
  wordValue: 0.1
  result: 1.8
0.7413.44
I'm not sure if I understand but task reward is if you completed…
3.35
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 41
  wordValue: 0.1
  result: 2.35
0.749.38
Spoke a bit on this in dms. @whilefoo my intent with referring t…
8.05
content:
  content:
    p:
      score: 1
      elementCount: 3
  result: 3
regex:
  wordCount: 101
  wordValue: 0.1
  result: 5.05
0.7422.54
Possibly. I personally haven't had that issue but either way my …
2.7
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 28
  wordValue: 0.1
  result: 1.7
0.747.56
I think it's fine. I generally scrutinize test code less than no…
2.06
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 16
  wordValue: 0.1
  result: 1.06
0.745.768

 [ 67.336 WXDAI ] 

@whilefoo
Contributions Overview
ViewContributionCountReward
ReviewBase Review125
ReviewCode Review66
IssueComment113.6
ReviewComment1122.736
Review Details
ChangesPriorityReward
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
+50 -5011
Conversation Incentives
CommentFormattingRelevancePriorityReward
there are a couple of options:1. we let the conversation-rewar…
16.99
content:
  content:
    p:
      score: 1
      elementCount: 6
    ol:
      score: 0
      elementCount: 1
    li:
      score: 1
      elementCount: 3
  result: 9
regex:
  wordCount: 173
  wordValue: 0.1
  result: 7.99
0.8413.6
```suggestionreturn result;```…
2.94
content:
  content:
    pre:
      score: 0
      elementCount: 1
    code:
      score: 1
      elementCount: 1
    p:
      score: 1
      elementCount: 1
  result: 2
regex:
  wordCount: 14
  wordValue: 0.1
  result: 0.94
0.742.072
I'm not sure if it's a good idea to rely on logs for testing, is…
2.54
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 25
  wordValue: 0.1
  result: 1.54
0.741.792
why so many nested functions? it becomes hard to read
1.71
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 10
  wordValue: 0.1
  result: 0.71
0.741.204
is there a reason we are using Decimal.js instead of native BigI…
1.88
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 13
  wordValue: 0.1
  result: 0.88
0.741.316
Shouldn't task be issue opening item and specification is pull r…
2.49
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 24
  wordValue: 0.1
  result: 1.49
0.741.736
I assume this is a permit for task assignee, but where are other…
2.28
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 20
  wordValue: 0.1
  result: 1.28
0.741.596
gotcha, I thought this html is for all users
1.65
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 9
  wordValue: 0.1
  result: 0.65
0.741.148
I can see from the example that it works correctly but when read…
7.38
content:
  content:
    p:
      score: 1
      elementCount: 3
    a:
      score: 1
      elementCount: 1
  result: 4
regex:
  wordCount: 63
  wordValue: 0.1
  result: 3.38
0.745.18
Ok so we need it for precise floating point calculations, in tha…
2.11
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 17
  wordValue: 0.1
  result: 1.11
0.741.484
why is it `ISSUER` which is meant for author of issue/re…
6.1
content:
  content:
    p:
      score: 1
      elementCount: 2
    code:
      score: 1
      elementCount: 2
  result: 4
regex:
  wordCount: 36
  wordValue: 0.1
  result: 2.1
0.744.284
this makes more sense!
1.32
content:
  content:
    p:
      score: 1
      elementCount: 1
  result: 1
regex:
  wordCount: 4
  wordValue: 0.1
  result: 0.32
0.740.924