Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
2c511557
Unverified
Commit
2c511557
authored
Mar 12, 2018
by
Taylor Thomas
Committed by
GitHub
Mar 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3646 from nicdoye/master
Accept .yml files as well as .yaml for templates.
parents
c5f2174f
73017d7e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
template.go
pkg/lint/rules/template.go
+3
-3
template_test.go
pkg/lint/rules/template_test.go
+3
-3
No files found.
pkg/lint/rules/template.go
View file @
2c511557
...
...
@@ -101,7 +101,7 @@ func Templates(linter *support.Linter, values []byte, namespace string, strict b
linter
.
RunLinterRule
(
support
.
ErrorSev
,
path
,
validateAllowedExtension
(
fileName
))
// We only apply the following lint rules to yaml files
if
filepath
.
Ext
(
fileName
)
!=
".yaml"
{
if
filepath
.
Ext
(
fileName
)
!=
".yaml"
||
filepath
.
Ext
(
fileName
)
==
".yml"
{
continue
}
...
...
@@ -138,7 +138,7 @@ func validateTemplatesDir(templatesPath string) error {
func
validateAllowedExtension
(
fileName
string
)
error
{
ext
:=
filepath
.
Ext
(
fileName
)
validExtensions
:=
[]
string
{
".yaml"
,
".tpl"
,
".txt"
}
validExtensions
:=
[]
string
{
".yaml"
,
".
yml"
,
".
tpl"
,
".txt"
}
for
_
,
b
:=
range
validExtensions
{
if
b
==
ext
{
...
...
@@ -146,7 +146,7 @@ func validateAllowedExtension(fileName string) error {
}
}
return
fmt
.
Errorf
(
"file extension '%s' not valid. Valid extensions are .yaml, .tpl, or .txt"
,
ext
)
return
fmt
.
Errorf
(
"file extension '%s' not valid. Valid extensions are .yaml, .
yml, .
tpl, or .txt"
,
ext
)
}
func
validateYamlContent
(
err
error
)
error
{
...
...
pkg/lint/rules/template_test.go
View file @
2c511557
...
...
@@ -28,11 +28,11 @@ import (
const
templateTestBasedir
=
"./testdata/albatross"
func
TestValidateAllowedExtension
(
t
*
testing
.
T
)
{
var
failTest
=
[]
string
{
"/foo"
,
"/test.
yml"
,
"/test.toml"
,
"test.y
ml"
}
var
failTest
=
[]
string
{
"/foo"
,
"/test.
to
ml"
}
for
_
,
test
:=
range
failTest
{
err
:=
validateAllowedExtension
(
test
)
if
err
==
nil
||
!
strings
.
Contains
(
err
.
Error
(),
"Valid extensions are .yaml, .tpl, or .txt"
)
{
t
.
Errorf
(
"validateAllowedExtension('%s') to return
\"
Valid extensions are .yaml, .tpl, or .txt
\"
, got no error"
,
test
)
if
err
==
nil
||
!
strings
.
Contains
(
err
.
Error
(),
"Valid extensions are .yaml, .
yml, .
tpl, or .txt"
)
{
t
.
Errorf
(
"validateAllowedExtension('%s') to return
\"
Valid extensions are .yaml, .
yml, .
tpl, or .txt
\"
, got no error"
,
test
)
}
}
var
successTest
=
[]
string
{
"/foo.yaml"
,
"foo.yaml"
,
"foo.tpl"
,
"/foo/bar/baz.yaml"
,
"NOTES.txt"
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment