Skip to content

Commit

Permalink
ci: appease biomi
Browse files Browse the repository at this point in the history
  • Loading branch information
bevzzz committed Dec 12, 2024
1 parent 28f4f54 commit 3bdc986
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 22 deletions.
4 changes: 2 additions & 2 deletions provider/pprof/_log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* It's only a temporary fixture -- there's probably a better solution to this.
*/

import { appendFileSync, closeSync, mkdirSync, openSync, statSync } from 'fs'
import { join } from 'path'
import { appendFileSync, closeSync, mkdirSync, openSync, statSync } from 'node:fs'
import { join } from 'node:path'

const logDir = `${process.env.HOME}/log/openctx`
const logFile = join(logDir, 'provider-pprof.log')
Expand Down
4 changes: 2 additions & 2 deletions provider/pprof/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ describe('pprof', () => {
uri: '/pkg/thing_test.go',
content: content,
},
{}
)
{},
),
).toHaveLength(0)
expect(getPprofMock).not.toBeCalled()
})
Expand Down
7 changes: 3 additions & 4 deletions provider/pprof/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { dirname } from 'path'
import { dirname } from 'node:path'
import type {
Annotation,
AnnotationsParams,
Expand Down Expand Up @@ -107,9 +107,8 @@ const pprof: Provider<Settings> = {
}

let item: Item = {
title: `pprof ${top.type}: cum ${node.cum}${top.unit}, ${node.cumPerc}% (#${
i + 1
}, sort=${settings.top?.sort || 'cum'})`,
title: `pprof ${top.type}: cum ${node.cum}${top.unit}, ${node.cumPerc}% (#${i + 1
}, sort=${settings.top?.sort || 'cum'})`,
}

const list = pprof.list(node.function)
Expand Down
6 changes: 3 additions & 3 deletions provider/pprof/pprof.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { execSync } from 'child_process'
import { type Dirent, type PathLike, accessSync, readdirSync } from 'fs'
import { execSync } from 'node:child_process'
import { type Dirent, type PathLike, accessSync, readdirSync } from 'node:fs'
import { beforeEach, describe, expect, test, vi } from 'vitest'
import {
type ListOutput,
Expand Down Expand Up @@ -285,7 +285,7 @@ ROUTINE ======================== main.buildDiamond in /Users/johndoe/go/src/loca

expect(execSyncMock).toHaveBeenCalledOnce()
expect(execSync).toHaveBeenCalledWith(
`pprof -list "example\\.\\(\\*Thing\\)\\.Do" ./mybinary report.mprof`
`pprof -list "example\\.\\(\\*Thing\\)\\.Do" ./mybinary report.mprof`,
)
expect(list).toStrictEqual<ListOutput>({ raw: stdout })
})
Expand Down
18 changes: 9 additions & 9 deletions provider/pprof/pprof.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { execSync } from 'child_process'
import { constants, accessSync, readdirSync } from 'fs'
import { basename, dirname, join, parse } from 'path'
import { execSync } from 'node:child_process'
import { constants, accessSync, readdirSync } from 'node:fs'
import { basename, dirname, join, parse } from 'node:path'
import { matchGlob } from '@openctx/provider'

/**
Expand Down Expand Up @@ -30,14 +30,14 @@ export function getPprof(): Pprof | null {
if (!stdout.endsWith('not found')) {
return new Pprof('go tool pprof')
}
} catch (e) {}
} catch (e) { }

try {
const stdout = execSync('which pprof').toString('utf-8').trim()
if (!stdout.endsWith('not found')) {
return new Pprof('pprof')
}
} catch (e) {}
} catch (e) { }

return null
}
Expand Down Expand Up @@ -283,10 +283,10 @@ export class Pprof {
// information to Cody.
nodes.push({
function: node.func,
flat: parseFloat(node.flat),
flatPerc: parseFloat(node.flatPerc),
cum: parseFloat(node.cum),
cumPerc: parseFloat(node.cumPerc),
flat: Number.parseFloat(node.flat),
flatPerc: Number.parseFloat(node.flatPerc),
cum: Number.parseFloat(node.cum),
cumPerc: Number.parseFloat(node.cumPerc),
})
}

Expand Down
4 changes: 2 additions & 2 deletions provider/pprof/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"compilerOptions": {
"rootDir": ".",
"outDir": "dist",
"lib": ["ESNext"],
"lib": ["ESNext"]
},
"include": ["*.ts"],
"exclude": ["dist", "vitest.config.ts"],
"references": [{ "path": "../../lib/provider" }],
"references": [{ "path": "../../lib/provider" }]
}

0 comments on commit 3bdc986

Please sign in to comment.