-
Notifications
You must be signed in to change notification settings - Fork 3
/
pass.go
26 lines (20 loc) · 641 Bytes
/
pass.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package gqlanalysis
import (
"fmt"
"github.com/vektah/gqlparser/v2/ast"
)
// A Pass provides information to the Run function that applies a specific analyzer.
// The Run function should not call any of the Pass functions concurrently.
type Pass struct {
Analyzer *Analyzer
Schema *ast.Schema
Queries []*ast.QueryDocument
Comments []*Comment
Report func(*Diagnostic)
ResultOf map[*Analyzer]interface{}
}
// Reportf reports a diagnostic with a format.
func (pass *Pass) Reportf(pos *ast.Position, format string, args ...interface{}) {
msg := fmt.Sprintf(format, args...)
pass.Report(&Diagnostic{Pos: pos, Message: msg})
}