Skip to content

Commit a219fa2

Browse files
committed
refactor: improve front matter error messages
Signed-off-by: Joseph Kato <joseph@jdkato.io>
1 parent 3843d07 commit a219fa2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

internal/lint/metadata.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,18 @@ func (l Linter) lintMetadata(f *core.File) error {
1919
if errors.Is(err, frontmatter.ErrNotFound) {
2020
return nil
2121
} else if err != nil {
22-
return err
22+
return core.NewE201FromPosition(err.Error(), f.Path, 1)
2323
}
2424

25-
frontmatter, fmErr := extractFrontMatter(f.Content, string(body))
25+
fm, fmErr := extractFrontMatter(f.Content, string(body))
2626
if fmErr != nil {
27-
return fmErr
27+
return core.NewE201FromPosition(fmErr.Error(), f.Path, 1)
2828
}
2929

3030
ignored := check.NewScope(l.Manager.Config.IgnoredScopes)
3131
for key, value := range metadata {
3232
if s, ok := value.(string); ok {
33-
i, _ := findBestLineBySubstring(frontmatter, s)
33+
i, _ := findBestLineBySubstring(fm, s)
3434
if i < 0 {
3535
continue
3636
}

0 commit comments

Comments
 (0)