# types/codemod.types.ts

> 23 lines of code and 3 definitions.

Tree: Governance tree
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/governance#file-governance-types-codemod-types-ts
Source text: https://banes-lab.com/source/governance/types/codemod.types.ts.txt

Listed in [types](https://banes-lab.com/api/source/governance/types.md), after [types/closure.types.ts](https://banes-lab.com/source/governance/types/closure.types.ts.md) and before [types/diagram.types.ts](https://banes-lab.com/source/governance/types/diagram.types.ts.md).

## Definitions

- `Edit` (interface_declaration, line 3, exported)
- `CodemodFinding` (interface_declaration, line 9, exported)
- `CodemodSpec` (interface_declaration, line 15, exported)

## Source

```typescript
import type { CheckDeclaration } from "@govlab/context";

export interface Edit {
    start: number;
    end: number;
    replacement: string;
}

export interface CodemodFinding {
    file: string;
    line: number;
    reason: string | null;
}

export interface CodemodSpec<F extends CodemodFinding> {
    checks: CheckDeclaration;
    ruleId: string;
    findings: readonly F[];
    programCount: number;
    editsByFile: (findings: readonly F[]) => Map<string, Edit[]>;
    label: (finding: F) => string;
    appliedNoun: string;
    blockedMessage: (finding: F) => string;
    gateOnBlocked: boolean;
    scopeNoun?: string;
}
```
