Closed katherinejensen00 closed 3 days ago
I'm not sure of where the best place to put this, but the following is some sample code that can be used to run the checks in C#. The ParatextChecks NuGet package will be needed.
const string projectName = "TPTS";
// NOTE: Platform.Bible already does this initialization stuff.
Console.WriteLine("Initializing...");
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
ParatextData.Initialize();
Console.WriteLine("Running Check(s)...");
ScrText scr = ScrTextCollection.Get(projectName);
ChapterVerseCheck check = new();
List<VerseListItem> errors = RunBasicChecks.Run(new List<ScriptureCheckBase> { check }, scr, BookSet.AllBooks, false);
if (errors.Count == 0)
Console.WriteLine("No Errors Found!!!!");
else
{
Console.WriteLine("Errors Found :(");
foreach (VerseListItem item in errors)
Console.WriteLine($" {item.VerseReference} {item.Message}");
}
Playing with TypeScript types to determine if project interfaces seem like a viable replacement for project types:
```typescript
const runGarbage = false;
// @ts-ignore
globalThis.runGarbage = runGarbage;
// @ts-ignore
if (globalThis.runGarbage) {
/* eslint-disable @typescript-eslint/no-unused-vars */
// Thanks to jcalz at https://stackoverflow.com/a/50375286
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type UnionToIntersection = (U extends any ? (x: U) => void : never) extends (
x: infer I,
) => void
? I
: never;
// eslint-disable-next-line no-type-assertion/no-type-assertion
const useProjectDataProviderFromInterfaces = (() => {}) as unknown as <
ProjectTypeArray extends ProjectTypes[],
>(
projectTypes: ProjectTypeArray,
projectDataProviderSource:
| string
| UnionToIntersection
PRs for projectInterface
s rework:
As an extension developer, I need to be able to create a custom check so that I can find the things I care about when proofing a text.
Design the anatomy of a check. Consider things like character and punctuation inventories (will these come through data providers?) and how will a check be run