Skip to content

Commit 19e177f

Browse files
authored
Un-export NewLocalRunner and AddLocalFile (#268)
1 parent d10b04f commit 19e177f

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

helper/runner.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,8 @@ func (r *Runner) EnsureNoError(err error, proc func() error) error {
350350
return err
351351
}
352352

353-
// NewLocalRunner initialises a new test runner.
354-
// Internal use only.
355-
func NewLocalRunner(files map[string]*hcl.File, issues Issues) *Runner {
353+
// newLocalRunner initialises a new test runner.
354+
func newLocalRunner(files map[string]*hcl.File, issues Issues) *Runner {
356355
return &Runner{
357356
files: map[string]*hcl.File{},
358357
sources: map[string][]byte{},
@@ -361,9 +360,9 @@ func NewLocalRunner(files map[string]*hcl.File, issues Issues) *Runner {
361360
}
362361
}
363362

364-
// AddLocalFile adds a new file to the current mapped files.
365-
// Internal use only.
366-
func (r *Runner) AddLocalFile(name string, file *hcl.File) bool {
363+
// addLocalFile adds a new file to the current mapped files.
364+
// For testing only. Normally, the main TFLint process is responsible for loading files.
365+
func (r *Runner) addLocalFile(name string, file *hcl.File) bool {
367366
if _, exists := r.files[name]; exists {
368367
return false
369368
}
@@ -373,6 +372,8 @@ func (r *Runner) AddLocalFile(name string, file *hcl.File) bool {
373372
return true
374373
}
375374

375+
// initFromFiles initializes the runner from locally added files.
376+
// For testing only.
376377
func (r *Runner) initFromFiles() error {
377378
for _, file := range r.files {
378379
content, _, diags := file.Body.PartialContent(configFileSchema)

helper/testing.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
func TestRunner(t *testing.T, files map[string]string) *Runner {
2020
t.Helper()
2121

22-
runner := NewLocalRunner(map[string]*hcl.File{}, Issues{})
22+
runner := newLocalRunner(map[string]*hcl.File{}, Issues{})
2323
parser := hclparse.NewParser()
2424

2525
for name, src := range files {
@@ -41,7 +41,7 @@ func TestRunner(t *testing.T, files map[string]string) *Runner {
4141
}
4242
runner.config = config
4343
} else {
44-
runner.AddLocalFile(name, file)
44+
runner.addLocalFile(name, file)
4545
}
4646
}
4747

0 commit comments

Comments
 (0)