Types
These type shapes are shared between OctoGuide’s API and Building Rules.
Entity
Section titled “Entity”A resolved entity retrieved from the GitHub API. It will contain:
data
: The direct data returned from the GitHub API.type
: The type of entity that was scanned, indicating whatdata
contains:"comment"
: issue or pull request comment data or discussion comment data"discussion"
: discussion data"issue"
: issue data"pull_request"
: pull request data
See entities.ts
for the specifics of the Entity
type union and its constituents.
RuleAbout
Section titled “RuleAbout”Metadata describing an OctoGuide rule.
The following properties are all required:
description: string
: Single sentence description of the rule.explanation: string[]
: Additional sentences describing the rule.name: string
: kebab-case name of the rule.
See rules.ts
for the specifics of the RuleAbout
interface.
RuleContext
Section titled “RuleContext”Shared context provided to rules when they run on an entity.
locator
: Contains theowner
andrepository
strings of the entity.octokit
:Octokit
: instance that can send GitHub API calls.report
:RuleReporter
: receivesRuleReportData
to register a new violation.
See rules.ts
for the specifics of the RuleContext
interface.
RuleReporter
Section titled “RuleReporter”Shared context function that a rule can use to register a new violation.
Receives a RuleReportData
object.
See Building Rules for how these are used.
See rules.ts
for the specifics of the RuleReporter
interface.
RuleReport
Section titled “RuleReport”A single report generated by a rule for a GitHub entity. Contains:
about
:RuleAbout
data
:RuleReportData
See reporters.ts
for the specifics of the RuleReport
interface.
RuleReportData
Section titled “RuleReportData”A single report generated by a rule for a GitHub entity. Contains:
primary: string
: Single sentence description of the reported violation.secondary?: string[]
: Any additional sentences detailing the violation.suggestion: string[]
: Steps the user can take to resolve the violation.
See Building Rules for how these are used.
See reporters.ts
for the specifics of the RuleReportData
interface.