From 15933ba620984654d16bfa3b4dcaae512688f68b Mon Sep 17 00:00:00 2001 From: ssube Date: Sun, 30 Jun 2019 21:03:12 -0500 Subject: [PATCH] feat: add default rule selector --- rules/ansible.yml | 2 -- rules/gitlab-ci.yml | 3 --- rules/grafana.yml | 2 -- rules/kubernetes.yml | 1 - rules/salty-dog.yml | 3 +-- src/rule.ts | 2 +- 6 files changed, 2 insertions(+), 11 deletions(-) diff --git a/rules/ansible.yml b/rules/ansible.yml index 2972faf..8be4ad8 100644 --- a/rules/ansible.yml +++ b/rules/ansible.yml @@ -7,7 +7,6 @@ rules: - ansible - playbook - select: '$' check: type: array items: @@ -38,7 +37,6 @@ rules: - ansible - role - select: '$' check: type: array items: diff --git a/rules/gitlab-ci.yml b/rules/gitlab-ci.yml index 5d87925..0c0a537 100644 --- a/rules/gitlab-ci.yml +++ b/rules/gitlab-ci.yml @@ -7,7 +7,6 @@ rules: - gitlab - optional - select: '$' check: type: object required: [stages] @@ -24,7 +23,6 @@ rules: - gitlab - optional - select: '$' check: type: object patternProperties: @@ -42,7 +40,6 @@ rules: - gitlab - important - select: '$' check: type: object patternProperties: diff --git a/rules/grafana.yml b/rules/grafana.yml index d9fd3d0..4a190c1 100644 --- a/rules/grafana.yml +++ b/rules/grafana.yml @@ -69,8 +69,6 @@ rules: - grafana - dashboard - # this is not the ideal selector for this rule, but tags are located at $.dashboard.tags, while notification - # channels are nested under $.dashboard.panels[*].alert.notifications[*].uid select: '$.dashboard' filter: diff --git a/rules/kubernetes.yml b/rules/kubernetes.yml index 3652579..4bb1ff7 100644 --- a/rules/kubernetes.yml +++ b/rules/kubernetes.yml @@ -108,7 +108,6 @@ rules: - kubernetes - labels - select: '$' check: type: object required: [metadata] diff --git a/rules/salty-dog.yml b/rules/salty-dog.yml index f51b867..4452655 100644 --- a/rules/salty-dog.yml +++ b/rules/salty-dog.yml @@ -10,7 +10,6 @@ definitions: - level - tags # data - - select - check properties: name: @@ -34,6 +33,7 @@ definitions: pattern: "[-:a-z0-9]+" select: type: string + default: '$' minLength: 1 filter: type: object @@ -59,7 +59,6 @@ rules: - important - salty-dog - select: '$' check: type: object additionalProperties: false diff --git a/src/rule.ts b/src/rule.ts index 72b7dde..60cc4d7 100644 --- a/src/rule.ts +++ b/src/rule.ts @@ -162,7 +162,7 @@ export class Rule implements RuleData, Visitor { this.desc = data.desc; this.level = data.level; this.name = data.name; - this.select = data.select; + this.select = data.select || '$'; this.tags = Array.from(data.tags); // copy schema objects