Skip to content

Commit

Permalink
fix: improve helm files detection
Browse files Browse the repository at this point in the history
  • Loading branch information
f1ames committed Dec 12, 2023
1 parent 8218758 commit 9fc0bc4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/parser/src/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ export function isUntypedKustomizationFile(filePath = ''): boolean {
return /kustomization*.yaml/.test(filePath.toLowerCase().trim());
}

const HELM_TEMPLATE_CONTENT_REGEX = /{{[^}]*}}/;

export function hasHelmTemplateContent(file: BaseFile) {
return HELM_TEMPLATE_CONTENT_REGEX.test(file.content || '');
return isHelmTemplateLike(file) || isHelmValuesLike(file);
}

function isHelmTemplateLike(file: BaseFile): boolean {
return file.path.includes('/templates/') || file.path.startsWith('templates/');
}

const HELM_VALUES_REGEX = /values[^\/|\\]*.(yaml|yml)/;

function isHelmValuesLike(file: BaseFile): boolean {
return HELM_VALUES_REGEX.test(file.path.toLocaleLowerCase());
}

0 comments on commit 9fc0bc4

Please sign in to comment.