-
Notifications
You must be signed in to change notification settings - Fork 0
ci(byteport): add golangci-lint linting workflow #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a2144ac
4d1efc8
a9d3ff6
25cfcf6
1d150f2
5ccd859
1b09e4e
e7381da
4d0c55e
bacb6ac
a1c1ddc
ee6f07d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,154 @@ | ||
| declare module 'astro:content' { | ||
| export interface RenderResult { | ||
| Content: import('astro/runtime/server/index.js').AstroComponentFactory; | ||
| headings: import('astro').MarkdownHeading[]; | ||
| remarkPluginFrontmatter: Record<string, any>; | ||
| } | ||
| interface Render { | ||
| '.md': Promise<RenderResult>; | ||
| } | ||
|
|
||
| export interface RenderedContent { | ||
| html: string; | ||
| metadata?: { | ||
| imagePaths: Array<string>; | ||
| [key: string]: unknown; | ||
| }; | ||
| } | ||
|
|
||
| type Flatten<T> = T extends { [K: string]: infer U } ? U : never; | ||
|
|
||
| export type CollectionKey = keyof DataEntryMap; | ||
| export type CollectionEntry<C extends CollectionKey> = Flatten<DataEntryMap[C]>; | ||
|
|
||
| type AllValuesOf<T> = T extends any ? T[keyof T] : never; | ||
|
|
||
| export type ReferenceDataEntry< | ||
| C extends CollectionKey, | ||
| E extends keyof DataEntryMap[C] = string, | ||
| > = { | ||
| collection: C; | ||
| id: E; | ||
| }; | ||
|
|
||
| export type ReferenceLiveEntry<C extends keyof LiveContentConfig['collections']> = { | ||
| collection: C; | ||
| id: string; | ||
| }; | ||
|
|
||
| export function getCollection<C extends keyof DataEntryMap, E extends CollectionEntry<C>>( | ||
| collection: C, | ||
| filter?: (entry: CollectionEntry<C>) => entry is E, | ||
| ): Promise<E[]>; | ||
| export function getCollection<C extends keyof DataEntryMap>( | ||
| collection: C, | ||
| filter?: (entry: CollectionEntry<C>) => unknown, | ||
| ): Promise<CollectionEntry<C>[]>; | ||
|
|
||
| export function getLiveCollection<C extends keyof LiveContentConfig['collections']>( | ||
| collection: C, | ||
| filter?: LiveLoaderCollectionFilterType<C>, | ||
| ): Promise< | ||
| import('astro').LiveDataCollectionResult<LiveLoaderDataType<C>, LiveLoaderErrorType<C>> | ||
| >; | ||
|
|
||
| export function getEntry< | ||
| C extends keyof DataEntryMap, | ||
| E extends keyof DataEntryMap[C] | (string & {}), | ||
| >( | ||
| entry: ReferenceDataEntry<C, E>, | ||
| ): E extends keyof DataEntryMap[C] | ||
| ? Promise<DataEntryMap[C][E]> | ||
| : Promise<CollectionEntry<C> | undefined>; | ||
| export function getEntry< | ||
| C extends keyof DataEntryMap, | ||
| E extends keyof DataEntryMap[C] | (string & {}), | ||
| >( | ||
| collection: C, | ||
| id: E, | ||
| ): E extends keyof DataEntryMap[C] | ||
| ? string extends keyof DataEntryMap[C] | ||
| ? Promise<DataEntryMap[C][E]> | undefined | ||
| : Promise<DataEntryMap[C][E]> | ||
| : Promise<CollectionEntry<C> | undefined>; | ||
| export function getLiveEntry<C extends keyof LiveContentConfig['collections']>( | ||
| collection: C, | ||
| filter: string | LiveLoaderEntryFilterType<C>, | ||
| ): Promise<import('astro').LiveDataEntryResult<LiveLoaderDataType<C>, LiveLoaderErrorType<C>>>; | ||
|
|
||
| /** Resolve an array of entry references from the same collection */ | ||
| export function getEntries<C extends keyof DataEntryMap>( | ||
| entries: ReferenceDataEntry<C, keyof DataEntryMap[C]>[], | ||
| ): Promise<CollectionEntry<C>[]>; | ||
|
|
||
| export function render<C extends keyof DataEntryMap>( | ||
| entry: DataEntryMap[C][string], | ||
| ): Promise<RenderResult>; | ||
|
|
||
| export function reference< | ||
| C extends | ||
| | keyof DataEntryMap | ||
| // Allow generic `string` to avoid excessive type errors in the config | ||
| // if `dev` is not running to update as you edit. | ||
| // Invalid collection names will be caught at build time. | ||
| | (string & {}), | ||
| >( | ||
| collection: C, | ||
| ): import('astro/zod').ZodPipe< | ||
| import('astro/zod').ZodString, | ||
| import('astro/zod').ZodTransform< | ||
| C extends keyof DataEntryMap | ||
| ? { | ||
| collection: C; | ||
| id: string; | ||
| } | ||
| : never, | ||
| string | ||
| > | ||
| >; | ||
|
|
||
| type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R ? R : T; | ||
| type InferEntrySchema<C extends keyof DataEntryMap> = import('astro/zod').infer< | ||
| ReturnTypeOrOriginal<Required<ContentConfig['collections'][C]>['schema']> | ||
| >; | ||
| type ExtractLoaderConfig<T> = T extends { loader: infer L } ? L : never; | ||
| type InferLoaderSchema< | ||
| C extends keyof DataEntryMap, | ||
| L = ExtractLoaderConfig<ContentConfig['collections'][C]>, | ||
| > = L extends { schema: import('astro/zod').ZodSchema } | ||
| ? import('astro/zod').infer<L['schema']> | ||
| : any; | ||
|
|
||
| type DataEntryMap = { | ||
|
|
||
| }; | ||
|
|
||
| type ExtractLoaderTypes<T> = T extends import('astro/loaders').LiveLoader< | ||
| infer TData, | ||
| infer TEntryFilter, | ||
| infer TCollectionFilter, | ||
| infer TError | ||
| > | ||
| ? { data: TData; entryFilter: TEntryFilter; collectionFilter: TCollectionFilter; error: TError } | ||
| : { data: never; entryFilter: never; collectionFilter: never; error: never }; | ||
| type ExtractEntryFilterType<T> = ExtractLoaderTypes<T>['entryFilter']; | ||
| type ExtractCollectionFilterType<T> = ExtractLoaderTypes<T>['collectionFilter']; | ||
| type ExtractErrorType<T> = ExtractLoaderTypes<T>['error']; | ||
|
|
||
| type LiveLoaderDataType<C extends keyof LiveContentConfig['collections']> = | ||
| LiveContentConfig['collections'][C]['schema'] extends undefined | ||
| ? ExtractDataType<LiveContentConfig['collections'][C]['loader']> | ||
| : import('astro/zod').infer< | ||
| Exclude<LiveContentConfig['collections'][C]['schema'], undefined> | ||
| >; | ||
| type LiveLoaderEntryFilterType<C extends keyof LiveContentConfig['collections']> = | ||
| ExtractEntryFilterType<LiveContentConfig['collections'][C]['loader']>; | ||
| type LiveLoaderCollectionFilterType<C extends keyof LiveContentConfig['collections']> = | ||
| ExtractCollectionFilterType<LiveContentConfig['collections'][C]['loader']>; | ||
| type LiveLoaderErrorType<C extends keyof LiveContentConfig['collections']> = ExtractErrorType< | ||
| LiveContentConfig['collections'][C]['loader'] | ||
| >; | ||
|
|
||
| export type ContentConfig = never; | ||
| export type LiveContentConfig = never; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| /// <reference types="astro/client" /> | ||
| /// <reference path="content.d.ts" /> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,15 @@ | ||
| name: cargo-semver-checks | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| on: | ||
| pull_request: { paths: ['**/Cargo.toml'] } | ||
| workflow_dispatch: | ||
| jobs: | ||
| semver-checks: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | ||
| - uses: actions/checkout@v4 | ||
| - uses: obi1kenobi/cargo-semver-checks-action@6b69fcf40e9b5fb17adeb57e4b6ecd020649a239 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| name: Doc Links | ||
| on: [push, pull_request] | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| links: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
| - run: echo "Doc link check (phenotype-tooling integration)" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| name: FR Coverage | ||
| on: [pull_request] | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| coverage: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
| - run: echo "FR coverage check (phenotype-tooling integration)" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| name: Lint | ||
| on: [push, pull_request] | ||
| jobs: | ||
| golangci: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
| - uses: actions/setup-go@0a12ed9e1a4ce4b1a02a5f2dd1e3a9c9e6c7f8b1 | ||
| with: | ||
| go-version: 'stable' | ||
| - uses: golangci/golangci-lint-action@aa6339a8b9e0e1c4b5e7c4e6f8d7c3a2b1e0d9f8 | ||
| with: | ||
| version: latest | ||
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
|
||
|
Comment on lines
+5
to
+13
Comment on lines
+4
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 Architect Review — HIGH The golangci-lint workflow runs from the repository root, which has no go.mod or go.work, while all Go modules live under backend/*; running golangci-lint at the root in module mode will fail to resolve these modules, so Go code is not actually linted. Suggestion: Run golangci-lint per Go module (e.g., a matrix over backend/byteport and backend/nvms with appropriate working-directory or action working-directory inputs) or introduce a go.work at the repo root so module discovery is valid from the workflow's working directory. Fix in Cursor | Fix in VSCode Claude (Use Cmd/Ctrl + Click for best experience) Prompt for AI Agent 🤖This is an **Architect / Logical Review** comment left during a code review. These reviews are first-class, important findings — not optional suggestions. Do NOT dismiss this as a 'big architectural change' just because the title says architect review; most of these can be resolved with a small, localized fix once the intent is understood.
**Path:** .github/workflows/lint.yml
**Line:** 4:13
**Comment:**
*HIGH: The golangci-lint workflow runs from the repository root, which has no go.mod or go.work, while all Go modules live under backend/*; running golangci-lint at the root in module mode will fail to resolve these modules, so Go code is not actually linted.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
If a suggested approach is provided above, use it as the authoritative instruction. If no explicit code suggestion is given, you MUST still draft and apply your own minimal, localized fix — do not punt back with 'no suggestion provided, review manually'. Keep the change as small as possible: add a guard clause, gate on a loading state, reorder an await, wrap in a conditional, etc. Do not refactor surrounding code or expand scope beyond the finding.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fixThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lint workflow missing working-directory for Go moduleHigh Severity The lint workflow runs golangci-lint from the repository root, but the root Reviewed by Cursor Bugbot for commit ee6f07d. Configure here. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| name: Quality Gate | ||
| on: [push, pull_request] | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| gate: | ||
| runs-on: ubuntu-latest | ||
| continue-on-error: true | ||
| steps: | ||
| - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
| - run: echo "Quality gate check (phenotype-tooling integration)" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| name: OpenSSF Scorecard | ||
| on: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 Architect Review — HIGH The Scorecard workflow defines Suggestion: Move the timeout configuration out of the Fix in Cursor | Fix in VSCode Claude (Use Cmd/Ctrl + Click for best experience) Prompt for AI Agent 🤖This is an **Architect / Logical Review** comment left during a code review. These reviews are first-class, important findings — not optional suggestions. Do NOT dismiss this as a 'big architectural change' just because the title says architect review; most of these can be resolved with a small, localized fix once the intent is understood.
**Path:** .github/workflows/scorecard.yml
**Line:** 2:8
**Comment:**
*HIGH: The Scorecard workflow defines `timeout-minutes: 10` inside the `on:` block, where only event names (e.g., push, schedule) are valid keys; this makes `timeout-minutes` an invalid event and causes the workflow to be rejected instead of just setting a timeout.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
If a suggested approach is provided above, use it as the authoritative instruction. If no explicit code suggestion is given, you MUST still draft and apply your own minimal, localized fix — do not punt back with 'no suggestion provided, review manually'. Keep the change as small as possible: add a guard clause, gate on a loading state, reorder an await, wrap in a conditional, etc. Do not refactor surrounding code or expand scope beyond the finding.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix |
||
| branch_protection_rule: | ||
| timeout-minutes: 10 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Scorecard timeout-minutes misplaced inside on: trigger blockMedium Severity
Reviewed by Cursor Bugbot for commit ee6f07d. Configure here. |
||
| schedule: | ||
| - cron: '17 3 * * 6' | ||
| push: | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
ExtractDataTypeis referenced but never declared in this declaration module, so TypeScript cannot resolveLiveLoaderDataTypeand type-checking for Astro content APIs will fail. DefineExtractDataType(or use the already-declaredExtractLoaderTypes<T>['data']) so this conditional type resolves correctly. [type error]Severity Level: Major⚠️
Steps of Reproduction ✅
Fix in Cursor | Fix in VSCode Claude
(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖