Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions check/legacy_resource_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"log"
"os"
"path/filepath"

"github.com/hashicorp/go-multierror"
)
Expand Down Expand Up @@ -58,6 +59,11 @@ func NewLegacyResourceFileCheck(opts *LegacyResourceFileOptions) *LegacyResource
func (check *LegacyResourceFileCheck) Run(path string, exampleLanguage string) error {
fullpath := check.Options.FullPath(path)

// skip cdktf directories
if IsValidCdktfDirectory(path) {
return nil
}

log.Printf("[DEBUG] Checking file: %s", fullpath)

if err := LegacyFileExtensionCheck(path); err != nil {
Expand All @@ -78,10 +84,12 @@ func (check *LegacyResourceFileCheck) Run(path string, exampleLanguage string) e
return fmt.Errorf("%s: error checking file frontmatter: %w", path, err)
}

if err := NewContentsCheck(check.Options.Contents).Run(fullpath, exampleLanguage); err != nil {
return fmt.Errorf("%s: error checking file contents: %w", path, err)
// We don't want to check the content for CDKTF files since they are converted
if !IsValidCdktfDirectory(filepath.Dir(fullpath)) {
if err := NewContentsCheck(check.Options.Contents).Run(fullpath, exampleLanguage); err != nil {
return fmt.Errorf("%s: error checking file contents: %w", path, err)
}
}

return nil
}

Expand Down
9 changes: 6 additions & 3 deletions check/registry_resource_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"log"
"os"
"path/filepath"

"github.com/hashicorp/go-multierror"
)
Expand Down Expand Up @@ -76,10 +77,12 @@ func (check *RegistryResourceFileCheck) Run(path string, exampleLanguage string)
return fmt.Errorf("%s: error checking file frontmatter: %w", path, err)
}

if err := NewContentsCheck(check.Options.Contents).Run(fullpath, exampleLanguage); err != nil {
return fmt.Errorf("%s: error checking file contents: %w", path, err)
// We don't want to check the content for CDKTF files since they are converted
if !IsValidCdktfDirectory(filepath.Dir(fullpath)) {
if err := NewContentsCheck(check.Options.Contents).Run(fullpath, exampleLanguage); err != nil {
return fmt.Errorf("%s: error checking file contents: %w", path, err)
}
}

return nil
}

Expand Down