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
d8616dd2
Commit
d8616dd2
authored
Sep 08, 2016
by
Adam Reese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(lint): allow .txt files
closes #1161
parent
36606cf1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
template.go
pkg/lint/rules/template.go
+2
-2
template_test.go
pkg/lint/rules/template_test.go
+3
-3
No files found.
pkg/lint/rules/template.go
View file @
d8616dd2
...
...
@@ -149,7 +149,7 @@ func validateQuotes(templateContent string) error {
func
validateAllowedExtension
(
fileName
string
)
error
{
ext
:=
filepath
.
Ext
(
fileName
)
validExtensions
:=
[]
string
{
".yaml"
,
".tpl"
}
validExtensions
:=
[]
string
{
".yaml"
,
".tpl"
,
".txt"
}
for
_
,
b
:=
range
validExtensions
{
if
b
==
ext
{
...
...
@@ -157,7 +157,7 @@ func validateAllowedExtension(fileName string) error {
}
}
return
fmt
.
Errorf
(
"file extension '%s' not valid. Valid extensions are .yaml
or .tpl
"
,
ext
)
return
fmt
.
Errorf
(
"file extension '%s' not valid. Valid extensions are .yaml
, .tpl, or .txt
"
,
ext
)
}
// validateNoMissingValues checks that all the {{}} functions returns a non empty value (<no value> or "")
...
...
pkg/lint/rules/template_test.go
View file @
d8616dd2
...
...
@@ -31,11 +31,11 @@ func TestValidateAllowedExtension(t *testing.T) {
var
failTest
=
[]
string
{
"/foo"
,
"/test.yml"
,
"/test.toml"
,
"test.yml"
}
for
_
,
test
:=
range
failTest
{
err
:=
validateAllowedExtension
(
test
)
if
err
==
nil
||
!
strings
.
Contains
(
err
.
Error
(),
"Valid extensions are .yaml
or .tpl
"
)
{
t
.
Errorf
(
"validateAllowedExtension('%s') to return
\"
Valid extensions are .yaml
or .tpl
\"
, got no error"
,
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
)
}
}
var
successTest
=
[]
string
{
"/foo.yaml"
,
"foo.yaml"
,
"foo.tpl"
,
"/foo/bar/baz.yaml"
}
var
successTest
=
[]
string
{
"/foo.yaml"
,
"foo.yaml"
,
"foo.tpl"
,
"/foo/bar/baz.yaml"
,
"NOTES.txt"
}
for
_
,
test
:=
range
successTest
{
err
:=
validateAllowedExtension
(
test
)
if
err
!=
nil
{
...
...
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