Skip to content

Commit

Permalink
feat: check no-duplicate-param in taskSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
verebecske authored and madbence committed Oct 28, 2020
1 parent 5c1baa2 commit 6c57245
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
80 changes: 80 additions & 0 deletions regression-tests/__snapshots__/regresion.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,22 @@ Array [
"path": "./regression-tests/duplicate-params.yaml",
"rule": "no-missing-param",
},
Object {
"level": "error",
"loc": Object {
"endColumn": 24,
"endLine": 51,
"range": Array [
851,
854,
],
"startColumn": 21,
"startLine": 51,
},
"message": "Duplicate param 'foo'",
"path": "./regression-tests/duplicate-params.yaml",
"rule": "no-duplicate-param",
},
Object {
"level": "error",
"loc": Object {
Expand Down Expand Up @@ -514,6 +530,22 @@ Array [
"path": "./regression-tests/duplicate-params.yaml",
"rule": "no-missing-param",
},
Object {
"level": "error",
"loc": Object {
"endColumn": 22,
"endLine": 63,
"range": Array [
1065,
1068,
],
"startColumn": 19,
"startLine": 63,
},
"message": "Duplicate param 'foo'",
"path": "./regression-tests/duplicate-params.yaml",
"rule": "no-duplicate-param",
},
Object {
"level": "warning",
"loc": Object {
Expand Down Expand Up @@ -882,6 +914,22 @@ Array [
"path": "./regression-tests/no-duplicate-param.yaml",
"rule": "no-duplicate-param",
},
Object {
"level": "error",
"loc": Object {
"endColumn": 22,
"endLine": 26,
"range": Array [
413,
416,
],
"startColumn": 19,
"startLine": 26,
},
"message": "Duplicate param 'foo'",
"path": "./regression-tests/no-duplicate-param.yaml",
"rule": "no-duplicate-param",
},
Object {
"level": "error",
"loc": Object {
Expand Down Expand Up @@ -3714,6 +3762,22 @@ Array [
"path": "./regression-tests/task-duplicate-params.yaml",
"rule": "no-missing-param",
},
Object {
"level": "error",
"loc": Object {
"endColumn": 24,
"endLine": 34,
"range": Array [
555,
558,
],
"startColumn": 21,
"startLine": 34,
},
"message": "Duplicate param 'foo'",
"path": "./regression-tests/task-duplicate-params.yaml",
"rule": "no-duplicate-param",
},
Object {
"level": "warning",
"loc": Object {
Expand Down Expand Up @@ -3778,6 +3842,22 @@ Array [
"path": "./regression-tests/task-duplicate-params.yaml",
"rule": "prefer-beta",
},
Object {
"level": "error",
"loc": Object {
"endColumn": 22,
"endLine": 46,
"range": Array [
766,
769,
],
"startColumn": 19,
"startLine": 46,
},
"message": "Duplicate param 'foo'",
"path": "./regression-tests/task-duplicate-params.yaml",
"rule": "no-duplicate-param",
},
Object {
"level": "warning",
"loc": Object {
Expand Down
3 changes: 3 additions & 0 deletions src/rules/no-duplicate-param.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export default (docs, tekton, report) => {
for (const pipeline of Object.values<any>(tekton.pipelines)) {
for (const task of pipeline.spec.tasks) {
checkParams(getParams('Task', task), report);
if (task.taskSpec) {
checkParams(getParams('Task', task.taskSpec), report);
}
}
}
};

0 comments on commit 6c57245

Please sign in to comment.