Skip to content

Commit 0a6746d

Browse files
committed
fix remaining existing lint issues
Signed-off-by: Callum Styan <[email protected]>
1 parent 668b430 commit 0a6746d

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

cmd/readmevalidation/coderresources.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func validateCoderResourceTags(tags []string) error {
110110
// parse any Terraform code snippets, and make some deeper guarantees about how
111111
// it's structured. Just validating whether it *can* be parsed as Terraform
112112
// would be a big improvement.
113-
var terraformVersionRe = regexp.MustCompile("^\\s*\\bversion\\s+=")
113+
var terraformVersionRe = regexp.MustCompile(`^\s*\bversion\s+=`)
114114

115115
func validateCoderResourceReadmeBody(body string) []error {
116116
trimmed := strings.TrimSpace(body)
@@ -257,9 +257,9 @@ func parseCoderResourceReadmeFiles(resourceType string, rms []readme) (map[strin
257257

258258
yamlValidationErrors := []error{}
259259
for _, readme := range resources {
260-
errors := validateCoderResourceReadme(readme)
261-
if len(errors) > 0 {
262-
yamlValidationErrors = append(yamlValidationErrors, errors...)
260+
errs := validateCoderResourceReadme(readme)
261+
if len(errs) > 0 {
262+
yamlValidationErrors = append(yamlValidationErrors, errs...)
263263
}
264264
}
265265
if len(yamlValidationErrors) != 0 {
@@ -274,7 +274,7 @@ func parseCoderResourceReadmeFiles(resourceType string, rms []readme) (map[strin
274274

275275
// Todo: Need to beef up this function by grabbing each image/video URL from
276276
// the body's AST.
277-
func validateCoderResourceRelativeUrls(resources map[string]coderResourceReadme) error {
277+
func validateCoderResourceRelativeUrls(_ map[string]coderResourceReadme) error {
278278
return nil
279279
}
280280

cmd/readmevalidation/readmefiles.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type readme struct {
2323
// from the main README body, returning both values in that order. It does not
2424
// validate whether the structure of the frontmatter is valid (i.e., that it's
2525
// structured as YAML).
26-
func separateFrontmatter(readmeText string) (string, string, error) {
26+
func separateFrontmatter(readmeText string) (readmeFrontmatter string, readmeBody string, err error) {
2727
if readmeText == "" {
2828
return "", "", xerrors.New("README is empty")
2929
}
@@ -66,7 +66,7 @@ func separateFrontmatter(readmeText string) (string, string, error) {
6666
return fm, strings.TrimSpace(body), nil
6767
}
6868

69-
var readmeHeaderRe = regexp.MustCompile("^(#{1,})(\\s*)")
69+
var readmeHeaderRe = regexp.MustCompile(`^(#+)(\s*)`)
7070

7171
// Todo: This seems to work okay for now, but the really proper way of doing
7272
// this is by parsing this as an AST, and then checking the resulting nodes.
@@ -167,10 +167,6 @@ const (
167167
// being parsed as YAML. This phase does not include YAML validation.
168168
validationPhaseReadmeParsing = "README parsing"
169169

170-
// validationPhaseReadmeValidation indicates when a README's frontmatter is
171-
// being validated as proper YAML with expected keys.
172-
validationPhaseReadmeValidation = "README validation"
173-
174170
// validationPhaseAssetCrossReference indicates when a README's frontmatter
175171
// is having all its relative URLs be validated for whether they point to
176172
// valid resources.

cmd/readmevalidation/repostructure.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ func validateCoderResourceSubdirectory(dirPath string) []error {
6363
errs = append(errs, addFilePathToError(mainTerraformPath, err))
6464
}
6565
}
66-
6766
}
6867

6968
return errs

0 commit comments

Comments
 (0)