Skip to content

Commit f310e2c

Browse files
committed
add lint warning if deploy-katee tag is set
1 parent 5e18b71 commit f310e2c

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

linters/deploy-katee.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ func LintDeployKateeTask(task manifest.DeployKatee, man manifest.Manifest, fs af
1313
}
1414

1515
if task.Tag != "" {
16+
errs = append(errs, NewErrDeprecatedField("tag", "now defaults to a unique id instead of gitref or version").AsWarning())
1617
if task.Tag != "version" && task.Tag != "gitref" {
1718
errs = append(errs, NewErrInvalidField("tag", "must be either 'version' or 'gitref'"))
1819
}

linters/errors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ var (
1212
ErrInvalidField = newError("invalid field")
1313
NewErrInvalidField = func(field string, reason string) Error { return ErrInvalidField.WithValue(field).WithValue(reason) }
1414

15-
ErrDeprecatedField = newError("deprecated field")
16-
NewDeprecatedField = func(field string, reason string) Error { return ErrDeprecatedField.WithValue(field).WithValue(reason) }
15+
ErrDeprecatedField = newError("deprecated field")
16+
NewErrDeprecatedField = func(field string, reason string) Error { return ErrDeprecatedField.WithValue(field).WithValue(reason) }
1717

1818
ErrFileNotFound = newError("file not found")
1919
ErrFileCannotRead = newError("file cannot be read")

linters/notifications.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ func LintNotifications(task manifest.Task) (errs []error) {
1111
default:
1212
n := task.GetNotifications()
1313
if len(n.OnSuccess) > 0 {
14-
errs = append(errs, NewDeprecatedField("on_success", notificationReasons).AsWarning())
14+
errs = append(errs, NewErrDeprecatedField("on_success", notificationReasons).AsWarning())
1515
}
1616
if n.OnSuccessMessage != "" {
17-
errs = append(errs, NewDeprecatedField("on_success_message", notificationReasons).AsWarning())
17+
errs = append(errs, NewErrDeprecatedField("on_success_message", notificationReasons).AsWarning())
1818
}
1919
if len(n.OnFailure) > 0 {
20-
errs = append(errs, NewDeprecatedField("on_failure", notificationReasons).AsWarning())
20+
errs = append(errs, NewErrDeprecatedField("on_failure", notificationReasons).AsWarning())
2121

2222
}
2323
if len(n.OnFailureMessage) > 0 {
24-
errs = append(errs, NewDeprecatedField("on_failure_message", notificationReasons).AsWarning())
24+
errs = append(errs, NewErrDeprecatedField("on_failure_message", notificationReasons).AsWarning())
2525
}
2626

2727
for _, n := range append(n.Failure, n.Success...) {

linters/notifications_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ func TestLintNotifications(t *testing.T) {
2323
result := LintNotifications(task)
2424

2525
assert.Len(t, result, 4)
26-
assert.Contains(t, result, NewDeprecatedField("on_success", notificationReasons).AsWarning())
27-
assert.Contains(t, result, NewDeprecatedField("on_success_message", notificationReasons).AsWarning())
28-
assert.Contains(t, result, NewDeprecatedField("on_failure", notificationReasons).AsWarning())
29-
assert.Contains(t, result, NewDeprecatedField("on_failure_message", notificationReasons).AsWarning())
26+
assert.Contains(t, result, NewErrDeprecatedField("on_success", notificationReasons).AsWarning())
27+
assert.Contains(t, result, NewErrDeprecatedField("on_success_message", notificationReasons).AsWarning())
28+
assert.Contains(t, result, NewErrDeprecatedField("on_failure", notificationReasons).AsWarning())
29+
assert.Contains(t, result, NewErrDeprecatedField("on_failure_message", notificationReasons).AsWarning())
3030
})
3131

3232
t.Run("does nothing for sequence or parallel", func(t *testing.T) {

0 commit comments

Comments
 (0)