Documentation
¶
Index ¶
- Constants
- Variables
- func GetDefaultMockPullRequestDetails() *github.PullRequest
- func Lint(file *ReviewpadFile, logger *logrus.Entry) error
- func MockGithubClient(clientOptions []mock.MockBackendOption) *gh.GithubClient
- func MustUnmarshal(data []byte, v interface{})
- func MustWriteBytes(w io.Writer, data []byte)
- type CheckState
- type Env
- type ExitStatus
- type GroupKind
- type GroupType
- type Interpreter
- type LoadEnv
- type NormalizeRule
- type PadGroup
- type PadImport
- type PadLabel
- type PadPipeline
- type PadRule
- type PadStage
- type PadWorkflow
- type PadWorkflowRule
- type Program
- type ReviewpadFile
- type Statement
Constants ¶
View Source
const ( PROFESSIONAL_EDITION string = "professional" TEAM_EDITION string = "team" SILENT_MODE string = "silent" VERBOSE_MODE string = "verbose" )
View Source
const DefaultMockEventAction = "opened"
View Source
const DefaultMockEventName = "pull_request"
View Source
const DefaultMockPrID = 1234
Use only for tests
View Source
const DefaultMockPrNum = 6
View Source
const DefaultMockPrOwner = "foobar"
View Source
const DefaultMockPrRepoName = "default-mock-repo"
Variables ¶
View Source
var DefaultMockCollector, _ = collector.NewCollector("", "distinctId", "pull_request", "runnerName", nil)
View Source
var DefaultMockCtx = context.Background()
Use only for tests
View Source
var DefaultMockEventDetails = &handler.EventDetails{ EventName: DefaultMockEventName, EventAction: DefaultMockEventAction, }
View Source
var DefaultMockEventPayload = &github.CheckRunEvent{}
View Source
var DefaultMockLogger = logrus.NewEntry(logrus.New())
View Source
var DefaultMockTargetEntity = &handler.TargetEntity{ Owner: DefaultMockPrOwner, Repo: DefaultMockPrRepoName, Number: DefaultMockPrNum, Kind: handler.PullRequest, }
Functions ¶
func GetDefaultMockPullRequestDetails ¶ added in v3.1.0
func GetDefaultMockPullRequestDetails() *github.PullRequest
func MockGithubClient ¶ added in v3.1.0
func MockGithubClient(clientOptions []mock.MockBackendOption) *gh.GithubClient
func MustUnmarshal ¶ added in v3.17.0
func MustUnmarshal(data []byte, v interface{})
func MustWriteBytes ¶ added in v3.17.0
Types ¶
type CheckState ¶ added in v3.24.0
type CheckState string
const ( CheckStateError CheckState = "error" CheckStateFailure CheckState = "failure" CheckStatePending CheckState = "pending" CheckStateSuccess CheckState = "success" )
type Env ¶
type Env struct { Ctx context.Context DryRun bool GithubClient *gh.GithubClient Collector collector.Collector Interpreter Interpreter TargetEntity *handler.TargetEntity EventDetails *handler.EventDetails Logger *logrus.Entry }
func MockEnvWith ¶ added in v3.2.0
func MockEnvWith(githubClient *gh.GithubClient, interpreter Interpreter, targetEntity *handler.TargetEntity, eventDetails *handler.EventDetails) (*Env, error)
func NewEvalEnv ¶
func NewEvalEnv( ctx context.Context, logger *logrus.Entry, dryRun bool, githubClient *gh.GithubClient, collector collector.Collector, targetEntity *handler.TargetEntity, interpreter Interpreter, eventDetails *handler.EventDetails, ) (*Env, error)
type ExitStatus ¶ added in v3.2.0
type ExitStatus int
const ExitStatusFailure ExitStatus = 1
const ExitStatusSuccess ExitStatus = 0
type GroupType ¶
type GroupType string
const GroupTypeFilter GroupType = "filter"
const GroupTypeStatic GroupType = "static"
type Interpreter ¶
type Interpreter interface { ProcessGroup(name string, kind GroupKind, typeOf GroupType, expr, paramExpr, whereExpr string) error ProcessLabel(id, name string) error ProcessRule(name, spec string) error EvalExpr(kind, expr string) (bool, error) ExecProgram(program *Program) (ExitStatus, error) ExecStatement(statement *Statement) error Report(mode string, safeMode bool) error ReportMetrics() error }
type NormalizeRule ¶ added in v3.6.0
type NormalizeRule struct { Validators []validator Modificators []modificator }
func NewNormalizeRule ¶ added in v3.6.0
func NewNormalizeRule() *NormalizeRule
func (*NormalizeRule) Do ¶ added in v3.6.0
func (n *NormalizeRule) Do(file *ReviewpadFile) (*ReviewpadFile, error)
func (*NormalizeRule) WithModificators ¶ added in v3.6.0
func (n *NormalizeRule) WithModificators(m ...modificator)
func (*NormalizeRule) WithValidators ¶ added in v3.6.0
func (n *NormalizeRule) WithValidators(v ...validator)
type PadPipeline ¶ added in v3.2.0
type PadWorkflow ¶
type PadWorkflow struct { Name string `yaml:"name"` On []handler.TargetEntityKind `yaml:"on"` Description string `yaml:"description"` AlwaysRun bool `yaml:"always-run"` Rules []PadWorkflowRule `yaml:"-"` Actions []string `yaml:"then"` NonNormalizedRules []interface{} `yaml:"if"` }
type PadWorkflowRule ¶
type Program ¶
type Program struct {
// contains filtered or unexported fields
}
func BuildProgram ¶ added in v3.2.0
func EvalCommand ¶ added in v3.22.0
EvalCommand generates the program to be executed when a command is received
func EvalConfigurationFile ¶ added in v3.22.0
func EvalConfigurationFile(file *ReviewpadFile, env *Env) (*Program, error)
EvalConfigurationFile generates the program to be executed Pre-condition Lint(file) == nil
func (*Program) GetProgramStatements ¶ added in v3.2.0
type ReviewpadFile ¶
type ReviewpadFile struct { Version string `yaml:"api-version"` Edition string `yaml:"edition"` Mode string `yaml:"mode"` IgnoreErrors *bool `yaml:"ignore-errors"` MetricsOnMerge *bool `yaml:"metrics-on-merge"` Imports []PadImport `yaml:"imports"` Extends []string `yaml:"extends"` Groups []PadGroup `yaml:"groups"` Rules []PadRule `yaml:"rules"` Labels map[string]PadLabel `yaml:"labels"` Workflows []PadWorkflow `yaml:"workflows"` Pipelines []PadPipeline `yaml:"pipelines"` Recipes map[string]*bool `yaml:"recipes"` }
type Statement ¶
type Statement struct {
// contains filtered or unexported fields
}
func BuildStatement ¶ added in v3.2.0
func (*Statement) GetStatementCode ¶ added in v3.2.0
Source Files
¶
Click to show internal directories.
Click to hide internal directories.