-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: correct tt.params - and make sure tested
Signed-off-by: mbwhite <[email protected]>
- Loading branch information
Showing
84 changed files
with
303 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
|
||
/** @type {import('@jest/types').Config.ProjectConfig} */ | ||
const config = { | ||
"roots": [ | ||
"<rootDir>/tests", | ||
"<rootDir>/regression-tests" | ||
], | ||
"testMatch": [ | ||
"**/?(*.)+(spec|test).+(ts|tsx|js)" | ||
], | ||
"transform": { | ||
"^.+\\.(ts|tsx)$": [ | ||
'ts-jest', | ||
{ | ||
useESM: true, | ||
}, | ||
], | ||
}, | ||
extensionsToTreatAsEsm: ['.ts'], | ||
"moduleNameMapper": { | ||
"^(\\.{1,2}/.*)\\.[jt]s$": "$1" | ||
}, | ||
|
||
"preset": "ts-jest" | ||
}; | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
"scripts": { | ||
"clean": "rimraf dist", | ||
"lint": "eslint --ext ts src", | ||
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js", | ||
"test": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js", | ||
"format": "prettier --write \"{src,test}/**/*.ts\"", | ||
"prebuild": "npm run format && npm run clean && npm run lint", | ||
"build": "tsc --pretty", | ||
|
@@ -18,6 +18,7 @@ | |
"type": "git", | ||
"url": "git+ssh://[email protected]/IBM/tekton-lint.git" | ||
}, | ||
"main":"dist/index.js", | ||
"bin": { | ||
"tekton-lint": "dist/lint.js" | ||
}, | ||
|
@@ -67,19 +68,7 @@ | |
"engines": { | ||
"node": ">= 20.0.0" | ||
}, | ||
"jest": { | ||
"roots": [ | ||
"<rootDir>/tests", | ||
"<rootDir>/regression-tests" | ||
], | ||
"testMatch": [ | ||
"**/?(*.)+(spec|test).+(ts|tsx|js)" | ||
], | ||
"transform": { | ||
"^.+\\.(ts|tsx)$": "ts-jest" | ||
}, | ||
"preset": "ts-jest" | ||
}, | ||
|
||
"husky": { | ||
"hooks": { | ||
"pre-commit": "npm run lint && npm test", | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"message":"Task 'array-params' defines parameter 'bar' with wrong type (only strings and arrays of strings are allowed)","rule":"no-invalid-param-type","level":"error","path":"./regression-tests/general/array-params.yaml","loc":{"range":[158,209,209],"startLine":12,"startColumn":7,"endLine":16,"endColumn":1}},{"message":"Task 'array-params' defines parameter 'baz' with wrong type (only strings and arrays of strings are allowed)","rule":"no-invalid-param-type","level":"error","path":"./regression-tests/general/array-params.yaml","loc":{"range":[215,257,257],"startLine":16,"startColumn":7,"endLine":19,"endColumn":1}},{"message":"Task 'array-params' defines parameter 'qux' with wrong type (only strings and arrays of strings are allowed)","rule":"no-invalid-param-type","level":"error","path":"./regression-tests/general/array-params.yaml","loc":{"range":[263,294,294],"startLine":19,"startColumn":7,"endLine":21,"endColumn":1}},{"message":"Pipeline 'task-param-array-pipeline' references task 'doesnt-exist' but the referenced task cannot be found. To fix this, include all the task definitions to the lint task for this pipeline.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/array-params.yaml","loc":{"range":[478,490,491],"startLine":31,"startColumn":15,"endLine":31,"endColumn":27}},{"message":"Task 'array-params' defines parameter 'foo', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/array-params.yaml","loc":{"range":[99,152,152],"startLine":8,"startColumn":7,"endLine":12,"endColumn":1}},{"message":"Task 'array-params' defines parameter 'bar', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/array-params.yaml","loc":{"range":[158,209,209],"startLine":12,"startColumn":7,"endLine":16,"endColumn":1}},{"message":"Task 'array-params' defines parameter 'baz', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/array-params.yaml","loc":{"range":[215,257,257],"startLine":16,"startColumn":7,"endLine":19,"endColumn":1}},{"message":"Task 'array-params' defines parameter 'qux', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/array-params.yaml","loc":{"range":[263,294,294],"startLine":19,"startColumn":7,"endLine":21,"endColumn":1}}] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"message":"Condition 'condition-with-invalid-param-name' defines parameter 'left!!' 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/conditions.yaml","loc":{"range":[419,425,426],"startLine":24,"startColumn":13,"endLine":24,"endColumn":19}},{"message":"Pipeline 'pipeline-with-missing-condition' references Condition 'missing-condition' but the referenced Condition cannot be found. To fix this, include all the Condition definitions to the lint task for this pipeline.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/conditions.yaml","loc":{"range":[775,807,807],"startLine":42,"startColumn":11,"endLine":43,"endColumn":1}},{"message":"Pipeline 'pipeline-with-missing-condition' references task 'task-without-params' but the referenced task cannot be found. To fix this, include all the task definitions to the lint task for this pipeline.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/conditions.yaml","loc":{"range":[727,746,747],"startLine":40,"startColumn":15,"endLine":40,"endColumn":34}},{"message":"Pipeline 'pipeline-with-multiple-conditions' references task 'task-without-params' but the referenced task cannot be found. To fix this, include all the task definitions to the lint task for this pipeline.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/conditions.yaml","loc":{"range":[987,1006,1007],"startLine":52,"startColumn":15,"endLine":52,"endColumn":34}},{"message":"Condition 'condition-with-unused-params' defines parameter 'left', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/conditions.yaml","loc":{"range":[121,151,151],"startLine":8,"startColumn":7,"endLine":10,"endColumn":1}},{"message":"Condition 'condition-with-unused-params' defines parameter 'right', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/conditions.yaml","loc":{"range":[157,188,188],"startLine":10,"startColumn":7,"endLine":12,"endColumn":1}},{"message":"Condition 'condition-with-invalid-param-name' defines parameter 'left!!', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/conditions.yaml","loc":{"range":[413,445,445],"startLine":24,"startColumn":7,"endLine":26,"endColumn":1}},{"message":"Task 'tekton-without-params' in Pipeline 'pipeline-with-missing-condition' is guarded by condition(s) ('missing-condition'). Conditions are deprecated, use WhenExpressions instead.","rule":"prefer-when-expression","level":"warning","path":"./regression-tests/general/conditions.yaml","loc":{"range":[773,807,807],"startLine":42,"startColumn":9,"endLine":43,"endColumn":1}},{"message":"Task 'tekton-without-params' in Pipeline 'pipeline-with-multiple-conditions' is guarded by condition(s) ('condition-with-unused-params, condition-with-unused-params'). Conditions are deprecated, use WhenExpressions instead.","rule":"prefer-when-expression","level":"warning","path":"./regression-tests/general/conditions.yaml","loc":{"range":[1033,1131,1131],"startLine":54,"startColumn":9,"endLine":56,"endColumn":1}}] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"message":"Task 'deprecated-task' is deprecated!","rule":"no-deprecated-resource","level":"warning","path":"./regression-tests/general/deprecated-resources.yaml","loc":{"range":[117,121,122],"startLine":7,"startColumn":28,"endLine":7,"endColumn":32}},{"message":"Pipeline 'deprecated-pipeline' is deprecated!","rule":"no-deprecated-resource","level":"warning","path":"./regression-tests/general/deprecated-resources.yaml","loc":{"range":[278,282,283],"startLine":17,"startColumn":28,"endLine":17,"endColumn":32}},{"message":"TriggerTemplate 'deprecated-triggertemplate' is deprecated!","rule":"no-deprecated-resource","level":"warning","path":"./regression-tests/general/deprecated-resources.yaml","loc":{"range":[441,445,446],"startLine":26,"startColumn":28,"endLine":26,"endColumn":32}}] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"message":"Duplicate param 'foo'","rule":"no-duplicate-param","level":"error","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[453,456,457],"startLine":30,"startColumn":13,"endLine":30,"endColumn":16}},{"message":"Duplicate param 'foo'","rule":"no-duplicate-param","level":"error","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[153,156,157],"startLine":10,"startColumn":15,"endLine":10,"endColumn":18}},{"message":"Duplicate param 'foo'","rule":"no-duplicate-param","level":"error","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[299,302,303],"startLine":20,"startColumn":13,"endLine":20,"endColumn":16}},{"message":"Duplicate param 'foo'","rule":"no-duplicate-param","level":"error","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[1214,1217,1218],"startLine":72,"startColumn":13,"endLine":72,"endColumn":16}},{"message":"Duplicate param 'foo'","rule":"no-duplicate-param","level":"error","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[1468,1471,1472],"startLine":83,"startColumn":19,"endLine":83,"endColumn":22}},{"message":"Duplicate param 'foo'","rule":"no-duplicate-param","level":"error","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[608,611,612],"startLine":38,"startColumn":17,"endLine":38,"endColumn":20}},{"message":"Duplicate param 'foo'","rule":"no-duplicate-param","level":"error","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[851,854,855],"startLine":51,"startColumn":21,"endLine":51,"endColumn":24}},{"message":"Duplicate param 'foo'","rule":"no-duplicate-param","level":"error","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[1065,1068,1069],"startLine":63,"startColumn":19,"endLine":63,"endColumn":22}},{"message":"Task 'my-task' has a parameter 'foo' that doesn't have a value in pipeline 'duplicate-params-pipeline'.","rule":"no-invalid-param-type","level":"error","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[608,611,612],"startLine":38,"startColumn":17,"endLine":38,"endColumn":20}},{"message":"Pipeline 'duplicate-params-pipeline-alpha-embedded' references task 'my-task', but parameter 'foo' is not supplied (it's a required param in 'my-task')","rule":"no-missing-param","level":"error","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[743,855,855],"startLine":46,"startColumn":7,"endLine":52,"endColumn":1}},{"message":"Pipeline 'duplicate-params-pipeline-alpha-embedded' references task 'my-task', but parameter 'foo' is not supplied (it's a required param in 'my-task')","rule":"no-missing-param","level":"error","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[743,855,855],"startLine":46,"startColumn":7,"endLine":52,"endColumn":1}},{"message":"Pipeline 'duplicate-params-pipeline-embedded' references task 'my-task', but parameter 'foo' is not supplied (it's a required param in 'my-task')","rule":"no-missing-param","level":"error","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[979,1069,1069],"startLine":59,"startColumn":7,"endLine":64,"endColumn":1}},{"message":"Pipeline 'duplicate-params-pipeline-embedded' references task 'my-task', but parameter 'foo' is not supplied (it's a required param in 'my-task')","rule":"no-missing-param","level":"error","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[979,1069,1069],"startLine":59,"startColumn":7,"endLine":64,"endColumn":1}},{"message":"Task 'duplicate-params-task-alpha' defines parameter 'foo', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[129,139,139],"startLine":9,"startColumn":9,"endLine":10,"endColumn":1}},{"message":"Task 'duplicate-params-task' defines parameter 'foo', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[277,287,287],"startLine":19,"startColumn":7,"endLine":20,"endColumn":1}},{"message":"TriggerTemplate 'duplicate-params-trigger' defines parameter 'foo', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[1192,1202,1202],"startLine":71,"startColumn":7,"endLine":72,"endColumn":1}},{"message":"Pipeline 'duplicate-params-pipeline' defines parameter 'foo', but it's not used anywhere in the spec","rule":"no-unused-param","level":"warning","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[431,441,441],"startLine":29,"startColumn":7,"endLine":30,"endColumn":1}},{"message":"Task 'duplicate-params-task-alpha' is defined with apiVersion tekton.dev/v1alpha1, consider migrating to tekton.dev/v1beta1","rule":"prefer-beta","level":"warning","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[16,35,36],"startLine":2,"startColumn":13,"endLine":2,"endColumn":32}},{"message":"Pipeline 'duplicate-params-pipeline-alpha-embedded' is defined with apiVersion tekton.dev/v1alpha1, consider migrating to tekton.dev/v1beta1","rule":"prefer-beta","level":"warning","path":"./regression-tests/general/duplicate-params.yaml","loc":{"range":[628,647,648],"startLine":40,"startColumn":13,"endLine":40,"endColumn":32}}] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"message":"'my-duplicated-task' is already defined (as a 'Task')","rule":"no-duplicate-resource","level":"error","path":"./regression-tests/general/duplicate-resources.yaml","loc":{"range":[103,121,122],"startLine":10,"startColumn":9,"endLine":10,"endColumn":27}},{"message":"'my-duplicated-pipeline' is already defined (as a 'Pipeline')","rule":"no-duplicate-resource","level":"error","path":"./regression-tests/general/duplicate-resources.yaml","loc":{"range":[462,484,485],"startLine":30,"startColumn":9,"endLine":30,"endColumn":31}},{"message":"'my-duplicated-triggerbinding' is already defined (as a 'TriggerBinding')","rule":"no-duplicate-resource","level":"error","path":"./regression-tests/general/duplicate-resources.yaml","loc":{"range":[846,874,875],"startLine":50,"startColumn":9,"endLine":50,"endColumn":37}},{"message":"'my-duplicated-eventlistener' is already defined (as a 'EventListener')","rule":"no-duplicate-resource","level":"error","path":"./regression-tests/general/duplicate-resources.yaml","loc":{"range":[1341,1368,1369],"startLine":75,"startColumn":9,"endLine":75,"endColumn":36}},{"message":"'my-duplicated-triggertemplate' is already defined (as a 'TriggerTemplate')","rule":"no-duplicate-resource","level":"error","path":"./regression-tests/general/duplicate-resources.yaml","loc":{"range":[1856,1885,1886],"startLine":99,"startColumn":9,"endLine":99,"endColumn":38}},{"message":"Pipeline 'my-duplicated-pipeline' references task 'my-beta-task' but the referenced task cannot be found. To fix this, include all the task definitions to the lint task for this pipeline.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/duplicate-resources.yaml","loc":{"range":[558,570,571],"startLine":35,"startColumn":15,"endLine":35,"endColumn":27}},{"message":"Pipeline 'my-duplicated-pipeline' references task 'my-beta-task' but the referenced task cannot be found. To fix this, include all the task definitions to the lint task for this pipeline.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/duplicate-resources.yaml","loc":{"range":[635,647,648],"startLine":38,"startColumn":15,"endLine":38,"endColumn":27}}] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"message":"Step 'my-step' has env variable 'FOO' duplicated in task 'env'.","rule":"no-duplicate-env","level":"error","path":"./regression-tests/general/env.yaml","loc":{"range":[192,195,196],"startLine":13,"startColumn":17,"endLine":13,"endColumn":20}}] |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"message":"EventListener 'listener-test' defines trigger binding 'binding-missing', but the trigger binding is missing.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/eventlistener-test.yaml","loc":{"range":[131,146,147],"startLine":8,"startColumn":15,"endLine":8,"endColumn":30}},{"message":"EventListener 'listener-test' defines trigger binding 'binding-missing', but the trigger binding is missing.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/eventlistener-test.yaml","loc":{"range":[223,238,239],"startLine":12,"startColumn":15,"endLine":12,"endColumn":30}},{"message":"EventListener 'listener-test' defines trigger template 'template-missing', but the trigger template is missing.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/eventlistener-test.yaml","loc":{"range":[177,193,194],"startLine":10,"startColumn":15,"endLine":10,"endColumn":31}},{"message":"EventListener 'listener-test' defines trigger template 'template-missing', but the trigger template is missing.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/eventlistener-test.yaml","loc":{"range":[269,285,286],"startLine":14,"startColumn":15,"endLine":14,"endColumn":31}},{"message":"EventListener 'uses-ref' defines trigger template 'pipeline-template', but the trigger template is missing.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/eventlistener-test.yaml","loc":{"range":[462,479,480],"startLine":25,"startColumn":14,"endLine":25,"endColumn":31}},{"message":"EventListener 'uses-name' defines trigger template 'pipeline-template', but the trigger template is missing.","rule":"no-missing-resource","level":"error","path":"./regression-tests/general/eventlistener-test.yaml","loc":{"range":[658,675,676],"startLine":36,"startColumn":15,"endLine":36,"endColumn":32}}] |
File renamed without changes.
1 change: 1 addition & 0 deletions
1
regression-tests/general/no-deprecated-resource.yaml.expect.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"message":"Task 'no-deprecated-resource-1' is deprecated!","rule":"no-deprecated-resource","level":"warning","path":"./regression-tests/general/no-deprecated-resource.yaml","loc":{"range":[126,130,131],"startLine":7,"startColumn":28,"endLine":7,"endColumn":32}},{"message":"Pipeline 'no-deprecated-resource-1' is deprecated!","rule":"no-deprecated-resource","level":"warning","path":"./regression-tests/general/no-deprecated-resource.yaml","loc":{"range":[386,390,391],"startLine":23,"startColumn":28,"endLine":23,"endColumn":32}}] |
File renamed without changes.
Oops, something went wrong.