File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -72,16 +72,19 @@ var readmeHeaderRe = regexp.MustCompile("^(#{1,})(\\s*)")
7272// this is by parsing this as an AST, and then checking the resulting nodes
7373func validateReadmeBody (body string ) []error {
7474 trimmed := strings .TrimSpace (body )
75- var errs []error
75+
76+ if trimmed == "" {
77+ return []error {errors .New ("README body is empty" )}
78+ }
7679
7780 // If the very first line of the README, there's a risk that the rest of the
7881 // validation logic will break, since we don't have many guarantees about
7982 // how the README is actually structured
8083 if ! strings .HasPrefix (trimmed , "# " ) {
81- errs = append (errs , errors .New ("README body must start with ATX-style h1 header (i.e., \" # \" )" ))
82- return errs
84+ return []error {errors .New ("README body must start with ATX-style h1 header (i.e., \" # \" )" )}
8385 }
8486
87+ var errs []error
8588 latestHeaderLevel := 0
8689 foundFirstH1 := false
8790 isInCodeBlock := false
You can’t perform that action at this time.
0 commit comments