@@ -41,15 +41,15 @@ func separateFrontmatter(readmeText string) (readmeFrontmatter string, readmeBod
4141 continue
4242 }
4343 // Break early if the very first line wasn't a fence, because then we
44- // know for certain that the README has problems
44+ // know for certain that the README has problems.
4545 if fenceCount == 0 {
4646 break
4747 }
4848
4949 // It should be safe to trim each line of the frontmatter on a per-line
5050 // basis, because there shouldn't be any extra meaning attached to the
5151 // indentation. The same does NOT apply to the README; best we can do is
52- // gather all the lines, and then trim around it
52+ // gather all the lines, and then trim around it.
5353 if inReadmeBody := fenceCount >= 2 ; inReadmeBody {
5454 body += nextLine + "\n "
5555 } else {
@@ -79,7 +79,7 @@ func validateReadmeBody(body string) []error {
7979
8080 // If the very first line of the README, there's a risk that the rest of the
8181 // validation logic will break, since we don't have many guarantees about
82- // how the README is actually structured
82+ // how the README is actually structured.
8383 if ! strings .HasPrefix (trimmed , "# " ) {
8484 return []error {xerrors .New ("README body must start with ATX-style h1 header (i.e., \" # \" )" )}
8585 }
@@ -95,7 +95,7 @@ func validateReadmeBody(body string) []error {
9595
9696 // Have to check this because a lot of programming languages support #
9797 // comments (including Terraform), and without any context, there's no
98- // way to tell the difference between a markdown header and code comment
98+ // way to tell the difference between a markdown header and code comment.
9999 if strings .HasPrefix (nextLine , "```" ) {
100100 isInCodeBlock = ! isInCodeBlock
101101 continue
@@ -122,7 +122,7 @@ func validateReadmeBody(body string) []error {
122122 }
123123
124124 // If we have obviously invalid headers, it's not really safe to keep
125- // proceeding with the rest of the content
125+ // proceeding with the rest of the content.
126126 if nextHeaderLevel == 1 {
127127 errs = append (errs , xerrors .New ("READMEs cannot contain more than h1 header" ))
128128 break
@@ -134,14 +134,14 @@ func validateReadmeBody(body string) []error {
134134
135135 // This is something we need to enforce for accessibility, not just for
136136 // the Registry website, but also when users are viewing the README
137- // files in the GitHub web view
137+ // files in the GitHub web view.
138138 if nextHeaderLevel > latestHeaderLevel && nextHeaderLevel != (latestHeaderLevel + 1 ) {
139139 errs = append (errs , xerrors .New ("headers are not allowed to increase more than 1 level at a time" ))
140140 continue
141141 }
142142
143143 // As long as the above condition passes, there's no problems with
144- // going up a header level or going down 1+ header levels
144+ // going up a header level or going down 1+ header levels.
145145 latestHeaderLevel = nextHeaderLevel
146146 }
147147
@@ -154,20 +154,20 @@ func validateReadmeBody(body string) []error {
154154type validationPhase string
155155
156156const (
157- // validationPhaseFileStructureValidation indicates when the entire Registry
157+ // ValidationPhaseFileStructureValidation indicates when the entire Registry
158158 // directory is being verified for having all files be placed in the file
159159 // system as expected.
160160 validationPhaseFileStructureValidation validationPhase = "File structure validation"
161161
162- // validationPhaseFileLoad indicates when README files are being read from
162+ // ValidationPhaseFileLoad indicates when README files are being read from
163163 // the file system.
164164 validationPhaseFileLoad = "Filesystem reading"
165165
166- // validationPhaseReadmeParsing indicates when a README's frontmatter is
166+ // ValidationPhaseReadmeParsing indicates when a README's frontmatter is
167167 // being parsed as YAML. This phase does not include YAML validation.
168168 validationPhaseReadmeParsing = "README parsing"
169169
170- // validationPhaseAssetCrossReference indicates when a README's frontmatter
170+ // ValidationPhaseAssetCrossReference indicates when a README's frontmatter
171171 // is having all its relative URLs be validated for whether they point to
172172 // valid resources.
173173 validationPhaseAssetCrossReference = "Cross-referencing relative asset URLs"
0 commit comments