Skip to content

Commit d49b518

Browse files
author
Lere Williams
committed
Draft analysis
1 parent 67ffdc0 commit d49b518

File tree

12 files changed

+2315
-790
lines changed

12 files changed

+2315
-790
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"extends": [
33
"oclif",
44
"oclif-typescript"
5-
]
5+
],
6+
"indent": ["SwitchCase", 2]
67
}

package-lock.json

Lines changed: 1303 additions & 768 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,15 @@
2121
"@oclif/plugin-help": "^5",
2222
"@oclif/plugin-plugins": "^5.0.18",
2323
"@oclif/plugin-warn-if-update-available": "^3.0.2",
24-
"octokit": "^3.1.1",
24+
"@octokit/plugin-paginate-rest": "^13.1.1",
25+
"@octokit/plugin-request-log": "^6.0.0",
26+
"@octokit/request-error": "^7.0.0",
27+
"@octokit/rest": "^22.0.0",
28+
"csv-parse": "^5.6.0",
29+
"duckdb-async": "^1.1.1",
30+
"node-fetch": "^3.3.2",
31+
"node-stream-zip": "^1.15.0",
32+
"p-limit": "^6.1.0",
2533
"read": "^3.0.1",
2634
"simple-git": "^3.20.0",
2735
"sizeup-core": "^0.5.7"
@@ -47,8 +55,13 @@
4755
"dirname": "sizeup",
4856
"default": ".",
4957
"commands": {
50-
"strategy": "single",
51-
"target": "./dist/index.js"
58+
"strategy": "pattern",
59+
"target": "./dist/commands"
60+
},
61+
"topics": {
62+
"stats": {
63+
"description": "Analyze stats generated by sizeup-action"
64+
}
5265
},
5366
"plugins": [
5467
"@oclif/plugin-help",

src/index.ts renamed to src/commands/evaluate.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
/* eslint-disable perfectionist/sort-classes */
22
import {Args, Command, Flags, ux} from '@oclif/core'
33
import * as fs from 'node:fs'
4-
import {Octokit} from 'octokit'
4+
import {Octokit} from '@octokit/rest'
55
import {read} from 'read'
66
import {simpleGit} from 'simple-git'
7-
import {Score, SizeUp as SizeUpCore} from 'sizeup-core'
7+
import {Score, SizeUp} from 'sizeup-core'
8+
9+
export default class Evaluate extends Command {
10+
static aliases = ['eval']
811

9-
export default class SizeUp extends Command {
1012
static args = {
1113
diff: Args.string({
1214
default: '',
@@ -46,6 +48,7 @@ export default class SizeUp extends Command {
4648
'token-path': Flags.string({
4749
char: 't',
4850
description: 'Path to a file containing a GitHub API token.\n'
51+
+ 'When evaluated a pull request from a private repository, this token must have the full `repo` scope and may also need to be SSO-enabled for the appropriate organization.\n'
4952
+ 'If this flag is omitted and the `diff` argument is a URL, then this tool will prompt for a token instead.',
5053
required: false,
5154
}),
@@ -59,7 +62,7 @@ export default class SizeUp extends Command {
5962
static strict = false
6063

6164
async run(): Promise<void> {
62-
const {args, flags} = await this.parse(SizeUp)
65+
const {args, flags} = await this.parse(Evaluate)
6366
let score: Score | undefined
6467

6568
if (args.diff?.startsWith('https://')) {
@@ -103,12 +106,12 @@ export default class SizeUp extends Command {
103106
const cloneDirectory = `/tmp/${repo}`
104107

105108
// Clear the contents of the clone directory,
106-
// otherwise SizeUpCore.evaluate will refuse to overwrite them.
109+
// otherwise SizeUp.evaluate will refuse to overwrite them.
107110
fs.rmSync(cloneDirectory, {force: true, recursive: true})
108111
fs.mkdirSync(cloneDirectory, {recursive: true})
109112

110113
return {
111-
result: SizeUpCore.evaluate(
114+
result: SizeUp.evaluate(
112115
{
113116
baseRef: pull.data.base.ref,
114117
cloneDirectory,
@@ -145,7 +148,7 @@ export default class SizeUp extends Command {
145148

146149
return this.reportProgress(
147150
`Evaluating the diff with the ${this.configChoice(flags)}`,
148-
async () => ({result: await SizeUpCore.evaluate(diff, flags['config-path'])}),
151+
async () => ({result: await SizeUp.evaluate(diff, flags['config-path'])}),
149152
)
150153
}
151154

@@ -165,7 +168,7 @@ export default class SizeUp extends Command {
165168

166169
return this.reportProgress(
167170
`Evaluating the diff with the ${this.configChoice(flags)}`,
168-
async () => ({result: await SizeUpCore.evaluate(diff, flags['config-path'])}),
171+
async () => ({result: await SizeUp.evaluate(diff, flags['config-path'])}),
169172
)
170173
}
171174

0 commit comments

Comments
 (0)