Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Datree
Commits
6223b382
Commit
6223b382
authored
4 years ago
by
myishay
Browse files
Options
Download
Email Patches
Plain Diff
wip: validate yaml files
parent
da582ed5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmd/test/testCommandHelper.go
+34
-0
cmd/test/testCommandHelper.go
with
34 additions
and
0 deletions
+34
-0
cmd/test/testCommandHelper.go
0 → 100644
+
34
-
0
View file @
6223b382
package
test
import
(
"fmt"
"time"
"github.com/briandowns/spinner"
"github.com/datreeio/datree/bl/evaluation"
"github.com/datreeio/datree/bl/validation"
)
func
createSpinner
(
text
string
,
color
string
)
*
spinner
.
Spinner
{
s
:=
spinner
.
New
(
spinner
.
CharSets
[
9
],
100
*
time
.
Millisecond
)
s
.
Suffix
=
text
s
.
Color
(
color
)
return
s
}
func
printEvaluationErrors
(
errors
[]
*
evaluation
.
Error
)
{
fmt
.
Println
(
"The following files failed:"
)
for
_
,
fileError
:=
range
errors
{
fmt
.
Printf
(
"
\n\t
Filename: %s
\n\t
Error: %s
\n
---------------------"
,
fileError
.
Filename
,
fileError
.
Message
)
}
fmt
.
Println
()
}
func
handleInvalidFiles
(
invalidFilesChan
chan
*
validation
.
InvalidFile
)
[]
*
validation
.
InvalidFile
{
time
.
Sleep
(
time
.
Millisecond
*
10000
)
var
invalidFiles
[]
*
validation
.
InvalidFile
for
invalidFile
:=
range
invalidFilesChan
{
invalidFiles
=
append
(
invalidFiles
,
invalidFile
)
}
return
invalidFiles
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help