Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
Merge pull request #22 from execjosh/bugfix/prevent-infinite-loop
Browse files Browse the repository at this point in the history
fix(lint): Prevent infinite loop
  • Loading branch information
b4b4r07 authored Mar 10, 2020
2 parents e80f7d2 + 65464cd commit 59f1177
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lint/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ func handleYAML(path string) (files []File, err error) {
if err == io.EOF {
break
}
if err != nil {
return files, err
}
documents = append(documents, bytes.Trim(res, "\x00"))
}

Expand Down
8 changes: 8 additions & 0 deletions lint/args_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package lint

import (
"bufio"
"testing"
)

Expand Down Expand Up @@ -112,3 +113,10 @@ func Test_filesFromArgs(t *testing.T) {
})
}
}

func Test_handleYAML_LineTooLong(t *testing.T) {
_, err := handleYAML("testdata/line-too-long.yaml")
if err != bufio.ErrTooLong {
t.Fatalf("want %q, got %q", bufio.ErrTooLong, err)
}
}
1 change: 1 addition & 0 deletions lint/testdata/line-too-long.yaml

Large diffs are not rendered by default.

0 comments on commit 59f1177

Please sign in to comment.