Skip to content

Commit

Permalink
fix: properties loading
Browse files Browse the repository at this point in the history
Signed-off-by: mbwhite <whitemat@uk.ibm.com>
  • Loading branch information
mbwhite committed Jan 22, 2024
1 parent dd1c0f1 commit 718f69e
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 4 deletions.
21 changes: 21 additions & 0 deletions regression-tests/fieldfound/gh0001/pipeline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: hello-goodbye
spec:
params:
- names: username
type: string
tasks:
- name: hello
taskRef:
name: hello
- name: goodbye
runAfter:
- hello
taskRef:
name: goodbye
params:
- name: username
value: $(params.username)
11 changes: 11 additions & 0 deletions regression-tests/fieldfound/gh0001/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: hello
spec:
steps:
- name: echo
image: alpine:3.19.0
script: |
#!/bin/sh
echo "Hello World"
13 changes: 13 additions & 0 deletions regression-tests/fieldfound/gh0001/task2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: goodbye
spec:
params:
- name: username
steps:
- name: echo
image: alpine:3.19.0
script: |
#!/bin/sh
echo "Hello World"
8 changes: 8 additions & 0 deletions regression-tests/fieldfound/gh0001/taskrun.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: hello-task-run
spec:
serviceAccountName: asd
taskRef:
name: hello
3 changes: 3 additions & 0 deletions regression-tests/fieldfound/gh0001/tektonlintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rules:
no-duplicate-resource: off
no-extra-param: warning
1 change: 0 additions & 1 deletion regression-tests/general/no-invalid-name.yaml.expect.json

This file was deleted.

6 changes: 4 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,17 @@ export class Config {
if (fs.existsSync(user_tektonlintrc)) {
const customRcFile = fs.readFileSync(user_tektonlintrc, 'utf8');
const customConfig = yaml.parse(customRcFile);
this._rulesConfig = { ...defaultConfig.rules, ...customConfig.rules };

logger.info('Using .tektonlintrc.yaml at %s', user_tektonlintrc);
logger.info('customConfig %o', customConfig);
this._rulesConfig = customConfig;

this._rulesConfig = { ...defaultConfig, ...customConfig };
this._rulesConfig.rules = { ...defaultConfig.rules, ...customConfig.rules };
this._globs = [...cliConfig['_'], ...(customConfig.globs ? customConfig.globs : [])];
} else {
logger.warn('Unable to find configuration - using defaults');
this._rulesConfig = defaultConfig;

this._globs = [...cliConfig['_']];
}

Expand Down
1 change: 0 additions & 1 deletion src/rules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import rules from './rule-loader.js';
import { logger } from './logger.js';
import { Tekton } from './interfaces/common.js';


const createReporter = (rule, config, reporter) => {
const isError = config.rules[rule] && config.rules[rule] === 'error';

Expand Down

0 comments on commit 718f69e

Please sign in to comment.