From 9bb31e060b0a03a51eb4f2adf54de9e733d8f2c2 Mon Sep 17 00:00:00 2001 From: mbwhite Date: Tue, 9 Jan 2024 18:13:18 +0000 Subject: [PATCH] fix: fix issue 57 Signed-off-by: mbwhite --- regression-tests/general/no-extra-param.yaml | 8 ++++---- regression-tests/general/no-extra-param.yaml.expect.json | 2 +- regression-tests/general/no-invalid-name.yaml.expect.json | 2 +- .../general/triggertemplate-test.yaml.expect.json | 2 +- src/rules/no-invalid-name.ts | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/regression-tests/general/no-extra-param.yaml b/regression-tests/general/no-extra-param.yaml index 68b2e67..7791f3d 100644 --- a/regression-tests/general/no-extra-param.yaml +++ b/regression-tests/general/no-extra-param.yaml @@ -1,12 +1,12 @@ --- -apiVersion: tekton.dev/v1beta1 +apiVersion: tekton.dev/v1 kind: Task metadata: name: no-extra-param-task spec: steps: [] --- -apiVersion: tekton.dev/v1beta1 +apiVersion: tekton.dev/v1 kind: Pipeline metadata: name: no-extra-param-pipeline @@ -25,7 +25,7 @@ spec: - name: foo value: foo --- -apiVersion: tekton.dev/v1alpha1 +apiVersion: tekton.dev/v1 kind: TriggerTemplate metadata: name: no-extra-param-template @@ -61,5 +61,5 @@ spec: - name: foo value: foo params: - - name: foo + - name: extra-param-foo value: foo diff --git a/regression-tests/general/no-extra-param.yaml.expect.json b/regression-tests/general/no-extra-param.yaml.expect.json index 451165b..0a6f637 100644 --- a/regression-tests/general/no-extra-param.yaml.expect.json +++ b/regression-tests/general/no-extra-param.yaml.expect.json @@ -1 +1 @@ -[{"message":"Pipeline 'no-extra-param-pipeline' references task 'no-extra-param-task' (as 'step-1'), and supplies parameter 'foo' to it, but it's not a valid parameter","rule":"no-extra-param","level":"error","path":"./regression-tests/general/no-extra-param.yaml","loc":{"range":[301,332,332],"startLine":19,"startColumn":11,"endLine":21,"endColumn":1}},{"message":"Pipeline 'no-extra-param-pipeline' references task 'step-1', and supplies parameter 'foo' to it, but it's not a valid parameter","rule":"no-extra-param","level":"error","path":"./regression-tests/general/no-extra-param.yaml","loc":{"range":[409,440,440],"startLine":25,"startColumn":11,"endLine":27,"endColumn":1}},{"message":"TriggerTemplate 'no-extra-param-template' references pipeline 'no-extra-param-pipeline', and supplies 'foo', but it's not a valid parameter.","rule":"no-extra-param","level":"error","path":"./regression-tests/general/no-extra-param.yaml","loc":{"range":[774,807,807],"startLine":42,"startColumn":13,"endLine":44,"endColumn":1}}] \ No newline at end of file +[{"message":"Pipeline 'no-extra-param-pipeline' references task 'no-extra-param-task' (as 'step-1'), and supplies parameter 'foo' to it, but it's not a valid parameter","rule":"no-extra-param","level":"error","path":"./regression-tests/general/no-extra-param.yaml","loc":{"range":[291,322,322],"startLine":19,"startColumn":11,"endLine":21,"endColumn":1}},{"message":"Pipeline 'no-extra-param-pipeline' references task 'step-1', and supplies parameter 'foo' to it, but it's not a valid parameter","rule":"no-extra-param","level":"error","path":"./regression-tests/general/no-extra-param.yaml","loc":{"range":[399,430,430],"startLine":25,"startColumn":11,"endLine":27,"endColumn":1}},{"message":"TriggerTemplate 'no-extra-param-template' references pipeline 'no-extra-param-pipeline', and supplies 'foo', but it's not a valid parameter.","rule":"no-extra-param","level":"error","path":"./regression-tests/general/no-extra-param.yaml","loc":{"range":[758,791,791],"startLine":42,"startColumn":13,"endLine":44,"endColumn":1}}] \ No newline at end of file diff --git a/regression-tests/general/no-invalid-name.yaml.expect.json b/regression-tests/general/no-invalid-name.yaml.expect.json index 6baf269..5047e57 100644 --- a/regression-tests/general/no-invalid-name.yaml.expect.json +++ b/regression-tests/general/no-invalid-name.yaml.expect.json @@ -1 +1 @@ -[{"message":"Task 'no-invalid-name' defines parameter '1-foo' with invalid parameter name (names are limited to alpha-numeric characters, '-' and '_' and can only start with alpha characters and '_')","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1767,1772,1782],"startLine":101,"startColumn":13,"endLine":101,"endColumn":18}},{"message":"Task 'no-invalid-name' defines parameter '-foo' with invalid parameter name (names are limited to alpha-numeric characters, '-' and '_' and can only start with alpha characters and '_')","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1794,1798,1808],"startLine":102,"startColumn":13,"endLine":102,"endColumn":17}},{"message":"Task 'no-invalid-name' defines parameter 'foo$bar' with invalid parameter name (names are limited to alpha-numeric characters, '-' and '_' and can only start with alpha characters and '_')","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1842,1849,1859],"startLine":104,"startColumn":13,"endLine":104,"endColumn":20}},{"message":"Invalid name for Task 'no-invalid-name-FooBar'. Names should be in lowercase, alphanumeric, kebab-case format.","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[64,86,96],"startLine":5,"startColumn":9,"endLine":5,"endColumn":31}},{"message":"Invalid name for Task 'no-invalid-name_foo'. Names should be in lowercase, alphanumeric, kebab-case format.","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[610,629,639],"startLine":40,"startColumn":9,"endLine":40,"endColumn":28}},{"message":"TriggerTemplate 'no-invalid-name' references pipeline 'no-invalid-name', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1249,1264,1265],"startLine":77,"startColumn":17,"endLine":77,"endColumn":32}},{"message":"TriggerTemplate 'no-invalid-name' references pipeline 'no-invalid-name', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1426,1441,1442],"startLine":84,"startColumn":17,"endLine":84,"endColumn":32}},{"message":"Task 'no-invalid-name' defines parameter 'foo', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1544,1559,1559],"startLine":92,"startColumn":7,"endLine":93,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'foo-', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1565,1581,1581],"startLine":93,"startColumn":7,"endLine":94,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'foo_', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1587,1603,1603],"startLine":94,"startColumn":7,"endLine":95,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'FOO_BAR', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1609,1628,1628],"startLine":95,"startColumn":7,"endLine":96,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'FooBar', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1634,1652,1652],"startLine":96,"startColumn":7,"endLine":97,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'fooBar', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1658,1676,1676],"startLine":97,"startColumn":7,"endLine":98,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'foo-bar', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1682,1701,1701],"startLine":98,"startColumn":7,"endLine":99,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'foo-1-bar', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1707,1728,1728],"startLine":99,"startColumn":7,"endLine":100,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'foo_1-bar', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1734,1755,1755],"startLine":100,"startColumn":7,"endLine":101,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter '1-foo', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1761,1782,1782],"startLine":101,"startColumn":7,"endLine":102,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter '-foo', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1788,1808,1808],"startLine":102,"startColumn":7,"endLine":103,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter '_foo', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1814,1830,1830],"startLine":103,"startColumn":7,"endLine":104,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'foo$bar', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1836,1859,1859],"startLine":104,"startColumn":7,"endLine":105,"endColumn":1}}] \ No newline at end of file +[{"message":"Task 'no-invalid-name' defines parameter '1-foo' with invalid parameter name (names are limited to alpha-numeric characters, '-' and '_' and can only start with alpha characters and '_')","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1767,1772,1782],"startLine":101,"startColumn":13,"endLine":101,"endColumn":18}},{"message":"Task 'no-invalid-name' defines parameter '-foo' with invalid parameter name (names are limited to alpha-numeric characters, '-' and '_' and can only start with alpha characters and '_')","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1794,1798,1808],"startLine":102,"startColumn":13,"endLine":102,"endColumn":17}},{"message":"Task 'no-invalid-name' defines parameter 'foo$bar' with invalid parameter name (names are limited to alpha-numeric characters, '-' and '_' and can only start with alpha characters and '_')","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1842,1849,1859],"startLine":104,"startColumn":13,"endLine":104,"endColumn":20}},{"message":"Invalid name for Task 'no-invalid-name-FooBar'. Names should be in lowercase, alphanumeric, kebab-case format. and follow DNS subdomain names","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[64,86,96],"startLine":5,"startColumn":9,"endLine":5,"endColumn":31}},{"message":"Invalid name for Task '-no-invalid-name'. Names should be in lowercase, alphanumeric, kebab-case format. and follow DNS subdomain names","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[178,194,204],"startLine":12,"startColumn":9,"endLine":12,"endColumn":25}},{"message":"Invalid name for Task '.no-invalid-name'. Names should be in lowercase, alphanumeric, kebab-case format. and follow DNS subdomain names","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[394,410,420],"startLine":26,"startColumn":9,"endLine":26,"endColumn":25}},{"message":"Invalid name for Task 'no-invalid-name_foo'. Names should be in lowercase, alphanumeric, kebab-case format. and follow DNS subdomain names","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[610,629,639],"startLine":40,"startColumn":9,"endLine":40,"endColumn":28}},{"message":"Invalid name for Task '1-no-invalid-name'. Names should be in lowercase, alphanumeric, kebab-case format. and follow DNS subdomain names","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[828,845,851],"startLine":54,"startColumn":9,"endLine":54,"endColumn":26}},{"message":"Invalid name for PipelineRun '-run-$(uid)'. Names should be in lowercase, alphanumeric, kebab-case format. and follow DNS subdomain names","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1356,1367,1377],"startLine":81,"startColumn":15,"endLine":81,"endColumn":26}},{"message":"TriggerTemplate 'no-invalid-name' references pipeline 'no-invalid-name', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1249,1264,1265],"startLine":77,"startColumn":17,"endLine":77,"endColumn":32}},{"message":"TriggerTemplate 'no-invalid-name' references pipeline 'no-invalid-name', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1426,1441,1442],"startLine":84,"startColumn":17,"endLine":84,"endColumn":32}},{"message":"Task 'no-invalid-name' defines parameter 'foo', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1544,1559,1559],"startLine":92,"startColumn":7,"endLine":93,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'foo-', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1565,1581,1581],"startLine":93,"startColumn":7,"endLine":94,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'foo_', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1587,1603,1603],"startLine":94,"startColumn":7,"endLine":95,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'FOO_BAR', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1609,1628,1628],"startLine":95,"startColumn":7,"endLine":96,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'FooBar', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1634,1652,1652],"startLine":96,"startColumn":7,"endLine":97,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'fooBar', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1658,1676,1676],"startLine":97,"startColumn":7,"endLine":98,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'foo-bar', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1682,1701,1701],"startLine":98,"startColumn":7,"endLine":99,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'foo-1-bar', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1707,1728,1728],"startLine":99,"startColumn":7,"endLine":100,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'foo_1-bar', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1734,1755,1755],"startLine":100,"startColumn":7,"endLine":101,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter '1-foo', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1761,1782,1782],"startLine":101,"startColumn":7,"endLine":102,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter '-foo', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1788,1808,1808],"startLine":102,"startColumn":7,"endLine":103,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter '_foo', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1814,1830,1830],"startLine":103,"startColumn":7,"endLine":104,"endColumn":1}},{"message":"Task 'no-invalid-name' defines parameter 'foo$bar', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/no-invalid-name.yaml","loc":{"range":[1836,1859,1859],"startLine":104,"startColumn":7,"endLine":105,"endColumn":1}}] \ No newline at end of file diff --git a/regression-tests/general/triggertemplate-test.yaml.expect.json b/regression-tests/general/triggertemplate-test.yaml.expect.json index d7721ee..c081817 100644 --- a/regression-tests/general/triggertemplate-test.yaml.expect.json +++ b/regression-tests/general/triggertemplate-test.yaml.expect.json @@ -1 +1 @@ -[{"message":"Resource ServiceAccount 'tutorial-service' has an invalid 'resourceVersion' key in its resource definition.","rule":"no-resourceversion","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[10712,10720,10721],"startLine":463,"startColumn":26,"endLine":463,"endColumn":34}},{"message":"'template-pipelineref-null' is already defined (as a 'TriggerTemplate')","rule":"no-duplicate-resource","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[3716,3741,3742],"startLine":164,"startColumn":9,"endLine":164,"endColumn":34}},{"message":"Invalid name for TriggerTemplate 'template-with-pipelineSpec'. Names should be in lowercase, alphanumeric, kebab-case format.","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[7045,7071,7072],"startLine":307,"startColumn":9,"endLine":307,"endColumn":35}},{"message":"Invalid name for TriggerTemplate 'template-pipelineSpec-without-tasks'. Names should be in lowercase, alphanumeric, kebab-case format.","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[7990,8025,8026],"startLine":348,"startColumn":9,"endLine":348,"endColumn":44}},{"message":"Invalid name for TriggerTemplate 'template-pipelineSpec-missing-and-extra-params'. Names should be in lowercase, alphanumeric, kebab-case format.","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[8866,8912,8913],"startLine":386,"startColumn":9,"endLine":386,"endColumn":55}},{"message":"Invalid name for TriggerTemplate 'template-with-serviceAccount'. Names should be in lowercase, alphanumeric, kebab-case format.","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[10158,10186,10187],"startLine":443,"startColumn":9,"endLine":443,"endColumn":37}},{"message":"TriggerTemplate 'template-with-params' references pipeline 'pipeline-with-params', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[764,784,785],"startLine":34,"startColumn":17,"endLine":34,"endColumn":37}},{"message":"TriggerTemplate 'template-without-params' references pipeline 'pr-pipeline', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[1591,1602,1603],"startLine":70,"startColumn":17,"endLine":70,"endColumn":28}},{"message":"TriggerTemplate 'template-pipelineref-null' references pipeline 'pipelineref-missing', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[4415,4434,4435],"startLine":194,"startColumn":19,"endLine":194,"endColumn":38}},{"message":"TriggerTemplate 'template-without-pipelineref' references pipeline 'null', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[3548,3548,3548],"startLine":156,"startColumn":18,"endLine":156,"endColumn":18}},{"message":"TriggerTemplate 'template-without-pipelinerun-params' references pipeline 'pipeline-with-taskref-without-params', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[6110,6146,6147],"startLine":265,"startColumn":19,"endLine":265,"endColumn":55}},{"message":"TriggerTemplate 'template-with-null-pipelinerun-params' references pipeline 'null', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[6952,6952,6952],"startLine":301,"startColumn":18,"endLine":301,"endColumn":18}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-with-params'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[586,603,604],"startLine":27,"startColumn":18,"endLine":27,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-without-params'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[1413,1430,1431],"startLine":63,"startColumn":18,"endLine":63,"endColumn":35}},{"message":"Undefined param 'target-branch' at .spec.resourcetemplates[2].spec.params[0].value in 'template-without-params'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[1670,1693,1694],"startLine":73,"startColumn":20,"endLine":73,"endColumn":43}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-pipelineref-null'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[4235,4252,4253],"startLine":187,"startColumn":18,"endLine":187,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-without-pipelineref'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[3369,3386,3387],"startLine":149,"startColumn":18,"endLine":149,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-without-pipelinerun-params'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[5930,5947,5948],"startLine":258,"startColumn":18,"endLine":258,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-with-null-pipelinerun-params'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[6773,6790,6791],"startLine":294,"startColumn":18,"endLine":294,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-with-pipelineSpec'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[7565,7582,7583],"startLine":330,"startColumn":18,"endLine":330,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-pipelineSpec-without-tasks'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[8519,8536,8537],"startLine":371,"startColumn":18,"endLine":371,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-pipelineSpec-missing-and-extra-params'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[9406,9423,9424],"startLine":409,"startColumn":18,"endLine":409,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[0].stringData.API_KEY in 'template-with-secret'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[10064,10081,10082],"startLine":438,"startColumn":18,"endLine":438,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[0].stringData.API_KEY in 'template-with-serviceAccount'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[10417,10434,10435],"startLine":455,"startColumn":18,"endLine":455,"endColumn":35}},{"message":"TriggerTemplate 'template-without-resource-templates' defines parameter 'target-branch', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[1828,1881,1881],"startLine":81,"startColumn":7,"endLine":83,"endColumn":1}},{"message":"TriggerTemplate 'template-without-pipelinerun-params' defines parameter 'target-branch', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[5459,5512,5512],"startLine":238,"startColumn":7,"endLine":240,"endColumn":1}},{"message":"TriggerTemplate 'template-with-null-pipelinerun-params' defines parameter 'target-branch', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[6302,6355,6355],"startLine":274,"startColumn":7,"endLine":276,"endColumn":1}},{"message":"TriggerTemplate 'template-pipelineSpec-missing-and-extra-params' defines parameter 'target-branch', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[8935,8988,8988],"startLine":389,"startColumn":7,"endLine":391,"endColumn":1}},{"message":"TriggerTemplate 'template-with-secret' defines parameter 'target-branch', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[9856,9909,9909],"startLine":429,"startColumn":7,"endLine":431,"endColumn":1}},{"message":"TriggerTemplate 'template-with-serviceAccount' defines parameter 'target-branch', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[10209,10262,10262],"startLine":446,"startColumn":7,"endLine":448,"endColumn":1}}] \ No newline at end of file +[{"message":"Resource ServiceAccount 'tutorial-service' has an invalid 'resourceVersion' key in its resource definition.","rule":"no-resourceversion","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[10712,10720,10721],"startLine":463,"startColumn":26,"endLine":463,"endColumn":34}},{"message":"'template-pipelineref-null' is already defined (as a 'TriggerTemplate')","rule":"no-duplicate-resource","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[3716,3741,3742],"startLine":164,"startColumn":9,"endLine":164,"endColumn":34}},{"message":"Invalid name for TriggerTemplate 'template-with-pipelineSpec'. Names should be in lowercase, alphanumeric, kebab-case format. and follow DNS subdomain names","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[7045,7071,7072],"startLine":307,"startColumn":9,"endLine":307,"endColumn":35}},{"message":"Invalid name for TriggerTemplate 'template-pipelineSpec-without-tasks'. Names should be in lowercase, alphanumeric, kebab-case format. and follow DNS subdomain names","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[7990,8025,8026],"startLine":348,"startColumn":9,"endLine":348,"endColumn":44}},{"message":"Invalid name for TriggerTemplate 'template-pipelineSpec-missing-and-extra-params'. Names should be in lowercase, alphanumeric, kebab-case format. and follow DNS subdomain names","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[8866,8912,8913],"startLine":386,"startColumn":9,"endLine":386,"endColumn":55}},{"message":"Invalid name for TriggerTemplate 'template-with-serviceAccount'. Names should be in lowercase, alphanumeric, kebab-case format. and follow DNS subdomain names","rule":"no-invalid-name","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[10158,10186,10187],"startLine":443,"startColumn":9,"endLine":443,"endColumn":37}},{"message":"TriggerTemplate 'template-with-params' references pipeline 'pipeline-with-params', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[764,784,785],"startLine":34,"startColumn":17,"endLine":34,"endColumn":37}},{"message":"TriggerTemplate 'template-without-params' references pipeline 'pr-pipeline', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[1591,1602,1603],"startLine":70,"startColumn":17,"endLine":70,"endColumn":28}},{"message":"TriggerTemplate 'template-pipelineref-null' references pipeline 'pipelineref-missing', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[4415,4434,4435],"startLine":194,"startColumn":19,"endLine":194,"endColumn":38}},{"message":"TriggerTemplate 'template-without-pipelineref' references pipeline 'null', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[3548,3548,3548],"startLine":156,"startColumn":18,"endLine":156,"endColumn":18}},{"message":"TriggerTemplate 'template-without-pipelinerun-params' references pipeline 'pipeline-with-taskref-without-params', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[6110,6146,6147],"startLine":265,"startColumn":19,"endLine":265,"endColumn":55}},{"message":"TriggerTemplate 'template-with-null-pipelinerun-params' references pipeline 'null', but the referenced pipeline cannot be found.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[6952,6952,6952],"startLine":301,"startColumn":18,"endLine":301,"endColumn":18}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-with-params'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[586,603,604],"startLine":27,"startColumn":18,"endLine":27,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-without-params'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[1413,1430,1431],"startLine":63,"startColumn":18,"endLine":63,"endColumn":35}},{"message":"Undefined param 'target-branch' at .spec.resourcetemplates[2].spec.params[0].value in 'template-without-params'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[1670,1693,1694],"startLine":73,"startColumn":20,"endLine":73,"endColumn":43}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-pipelineref-null'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[4235,4252,4253],"startLine":187,"startColumn":18,"endLine":187,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-without-pipelineref'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[3369,3386,3387],"startLine":149,"startColumn":18,"endLine":149,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-without-pipelinerun-params'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[5930,5947,5948],"startLine":258,"startColumn":18,"endLine":258,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-with-null-pipelinerun-params'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[6773,6790,6791],"startLine":294,"startColumn":18,"endLine":294,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-with-pipelineSpec'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[7565,7582,7583],"startLine":330,"startColumn":18,"endLine":330,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-pipelineSpec-without-tasks'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[8519,8536,8537],"startLine":371,"startColumn":18,"endLine":371,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[1].stringData.API_KEY in 'template-pipelineSpec-missing-and-extra-params'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[9406,9423,9424],"startLine":409,"startColumn":18,"endLine":409,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[0].stringData.API_KEY in 'template-with-secret'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[10064,10081,10082],"startLine":438,"startColumn":18,"endLine":438,"endColumn":35}},{"message":"Undefined param 'api-key' at .spec.resourcetemplates[0].stringData.API_KEY in 'template-with-serviceAccount'","rule":"no-undefined-param","level":"error","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[10417,10434,10435],"startLine":455,"startColumn":18,"endLine":455,"endColumn":35}},{"message":"TriggerTemplate 'template-without-resource-templates' defines parameter 'target-branch', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[1828,1881,1881],"startLine":81,"startColumn":7,"endLine":83,"endColumn":1}},{"message":"TriggerTemplate 'template-without-pipelinerun-params' defines parameter 'target-branch', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[5459,5512,5512],"startLine":238,"startColumn":7,"endLine":240,"endColumn":1}},{"message":"TriggerTemplate 'template-with-null-pipelinerun-params' defines parameter 'target-branch', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[6302,6355,6355],"startLine":274,"startColumn":7,"endLine":276,"endColumn":1}},{"message":"TriggerTemplate 'template-pipelineSpec-missing-and-extra-params' defines parameter 'target-branch', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[8935,8988,8988],"startLine":389,"startColumn":7,"endLine":391,"endColumn":1}},{"message":"TriggerTemplate 'template-with-secret' defines parameter 'target-branch', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[9856,9909,9909],"startLine":429,"startColumn":7,"endLine":431,"endColumn":1}},{"message":"TriggerTemplate 'template-with-serviceAccount' defines parameter 'target-branch', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/triggertemplate-test.yaml","loc":{"range":[10209,10262,10262],"startLine":446,"startColumn":7,"endLine":448,"endColumn":1}}] \ No newline at end of file diff --git a/src/rules/no-invalid-name.ts b/src/rules/no-invalid-name.ts index 9e9f524..d5020a4 100644 --- a/src/rules/no-invalid-name.ts +++ b/src/rules/no-invalid-name.ts @@ -1,7 +1,7 @@ import collectResources from '../collect-resources.js'; const isValidName = (name) => { - const valid = new RegExp('^[a-z0-9-()$.]*$'); + const valid = new RegExp('^[a-zA-Z_][a-z0-9-()$.]*$'); return valid.test(name); }; @@ -47,7 +47,7 @@ export default (docs, tekton, report) => { report( `Invalid name for ${kind} '${ (resource as any).metadata.name - }'. Names should be in lowercase, alphanumeric, kebab-case format.`, + }'. Names should be in lowercase, alphanumeric, kebab-case format. and follow DNS subdomain names`, (resource as any).metadata, 'name', );