Skip to content

Commit 2ad511c

Browse files
author
maxiwoj
committed
Validation Namings
Changed validation naming convention to match our current validation approach.
1 parent 5dc47c9 commit 2ad511c

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ To validate your template, just type:
8383
~ $ perun validate <PATH TO YOUR TEMPLATE>
8484
```
8585
Your template will be then validated using both our validation mechanism and AWS API
86-
(*online validation*).
86+
(*aws validation*).
8787

8888
#### Configuration
8989
To create your own configuration file use `configure` mode:

cliparser/cliparser.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func ParseCliArguments(args []string) (cliArguments CliArguments, err error) {
171171

172172
switch kingpin.MustParse(app.Parse(args[1:])) {
173173

174-
//online validate
174+
// validate
175175
case validate.FullCommand():
176176
cliArguments.Mode = &ValidateMode
177177
cliArguments.TemplatePath = validateTemplate

validator/onlinevalidator.go validator/awsvalidator.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// See the License for the specific language governing permissions and
1515
// limitations under the License.
1616

17-
// Package onlinevalidator provides tools for online CloudFormation template
17+
// Package awsvalidator provides tools for online CloudFormation template
1818
// validation using AWS API.
1919
package validator
2020

File renamed without changes.

validator/offlinevalidator.go validator/localvalidator.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// See the License for the specific language governing permissions and
1515
// limitations under the License.
1616

17-
// Package validator provides tools for offline CloudFormation template
17+
// Package validator provides tools for local CloudFormation template
1818
// validation.
1919
package validator
2020

@@ -98,7 +98,7 @@ func validateTemplateFile(templatePath string, templateName string, context *con
9898
resources := obtainResources(deNilizedTemplate, perunTemplate, context.Logger)
9999
deadResources := getNilResources(resources)
100100
deadProperties := getNilProperties(resources)
101-
if hasAllowedValuesParametersValid(goFormationTemplate.Parameters, context.Logger) {
101+
if hasAllowedValuesParametersValid(goFormationTemplate.Parameters) {
102102
valid = true
103103
} else {
104104
valid = false
@@ -115,7 +115,7 @@ func validateTemplateFile(templatePath string, templateName string, context *con
115115
}
116116

117117
// Looking for AllowedValues and checking what Type is it. If it finds Type other than String then it will return false.
118-
func hasAllowedValuesParametersValid(parameters template.Parameters, logger logger.LoggerInt) bool {
118+
func hasAllowedValuesParametersValid(parameters template.Parameters) bool {
119119
isType := false
120120
isAllovedValues := false
121121
for _, value := range parameters {

validator/offlinevalidator_test.go validator/localvalidator_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import (
3030

3131
var spec specification.Specification
3232

33-
var sink logger.Logger
33+
//var _ logger.Logger
3434

3535
var deadProp = make([]string, 0)
3636
var deadRes = make([]string, 0)
@@ -342,25 +342,25 @@ func TestInvalidMapProperty(t *testing.T) {
342342
}
343343

344344
func TestHasAllowedValuesParametersValid(t *testing.T) {
345-
sink = logger.Logger{}
345+
_ = logger.Logger{}
346346
data := make(map[string]interface{})
347347

348348
data["AllowedValues"] = ""
349349
data["Type"] = "String"
350350
parameters := createParameters("Correct", data)
351351

352-
assert.True(t, hasAllowedValuesParametersValid(parameters, &sink), "This template has AllowedValues with Type String")
352+
assert.True(t, hasAllowedValuesParametersValid(parameters), "This template has AllowedValues with Type String")
353353
}
354354

355355
func TestHasAllowedValuesParametersInvalid(t *testing.T) {
356-
sink = logger.Logger{}
356+
_ = logger.Logger{}
357357
data := make(map[string]interface{})
358358

359359
data["AllowedValues"] = ""
360360
data["Type"] = "AWS::EC2::VPC::Id"
361361
parameters := createParameters("Incorrect", data)
362362

363-
assert.False(t, hasAllowedValuesParametersValid(parameters, &sink), "This template has AllowedValues with Type other than String")
363+
assert.False(t, hasAllowedValuesParametersValid(parameters), "This template has AllowedValues with Type other than String")
364364
}
365365

366366
func createResourceWithNestedProperties(resourceType string, propertyName string, nestedPropertyValue map[string]interface{}) template.Resource {

0 commit comments

Comments
 (0)