Skip to content

Commit

Permalink
refactor: linting
Browse files Browse the repository at this point in the history
Signed-off-by: Luis Davim <[email protected]>
  • Loading branch information
luisdavim committed Jun 5, 2022
1 parent 9a8357d commit 4874936
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
3 changes: 3 additions & 0 deletions examples/composition/argo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ namespaces:
- name: "requests.nvidia.com/gpu"
value: "2"

helmRepos:
argo: "https://argoproj.github.io/argo-helm"

apps:
argo:
namespace: "staging"
Expand Down
8 changes: 2 additions & 6 deletions internal/app/spec_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type StateFiles struct {
StateFiles []StatePath `yaml:"stateFiles"`
}

// fromYAML reads a yaml file and decodes it to a state type.
// specFromYAML reads a yaml file and decodes it to a state type.
// parser which throws an error if the YAML file is not valid.
func (pc *StateFiles) specFromYAML(file string) error {
rawYamlFile, err := ioutil.ReadFile(file)
Expand All @@ -25,9 +25,5 @@ func (pc *StateFiles) specFromYAML(file string) error {

yamlFile := string(rawYamlFile)

if err = yaml.UnmarshalStrict([]byte(yamlFile), pc); err != nil {
return err
}

return nil
return yaml.UnmarshalStrict([]byte(yamlFile), pc)
}
13 changes: 10 additions & 3 deletions internal/app/spec_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ func Test_specFromYAML(t *testing.T) {
s: new(StateFiles),
},
want: false,
}, {
name: "test case 3 -- Commposition example",
args: args{
file: "../../examples/composition/spec.yaml",
s: new(StateFiles),
},
want: true,
},
}

Expand Down Expand Up @@ -66,9 +73,9 @@ func Test_specFileSort(t *testing.T) {
args: args{
files: fileOptionArray(
[]fileOption{
fileOption{"third.yaml", 0},
fileOption{"first.yaml", -20},
fileOption{"second.yaml", -10},
{"third.yaml", 0},
{"first.yaml", -20},
{"second.yaml", -10},
}),
},
want: [3]int{-20, -10, 0},
Expand Down

0 comments on commit 4874936

Please sign in to comment.