-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix(general): exclude __start_line__ and __end_line__ from is empty solver #7156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ca272d6
exclude __start_line__ and __end_line__ from is empty check
omriyoffe-panw b893e0e
switch Sized to Collection
omriyoffe-panw a867f17
add check for hcl2 start and end line
omriyoffe-panw 7101b78
Merge branch 'main' into fix-is-empty-solver
omriyoffe-panw 1d404cf
add is not empty test
omriyoffe-panw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
19 changes: 19 additions & 0 deletions
19
tests/kubernetes/graph/checks/resources/IsNotEmpty/Failing/deployment.yaml
This file contains hidden or 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,19 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: failing-selector-deployment | ||
| spec: | ||
| replicas: 2 | ||
| # Intentionally leaving matchLabels empty | ||
| selector: | ||
| matchLabels: {} | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: my-failing-selector-app | ||
| spec: | ||
| containers: | ||
| - name: my-container | ||
| image: nginx:latest | ||
| ports: | ||
| - containerPort: 80 |
19 changes: 19 additions & 0 deletions
19
tests/kubernetes/graph/checks/resources/IsNotEmpty/Passing/deployment.yaml
This file contains hidden or 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,19 @@ | ||
| apiVersion: apps/v1 | ||
| kind: Deployment | ||
| metadata: | ||
| name: passing-selector-deployment | ||
| spec: | ||
| replicas: 2 | ||
| selector: | ||
| matchLabels: | ||
| app: my-passing-selector-app | ||
| template: | ||
| metadata: | ||
| labels: | ||
| app: my-passing-selector-app | ||
| spec: | ||
| containers: | ||
| - name: my-container | ||
| image: nginx:latest | ||
| ports: | ||
| - containerPort: 80 |
4 changes: 4 additions & 0 deletions
4
tests/kubernetes/graph/checks/resources/IsNotEmpty/expected.yaml
This file contains hidden or 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,4 @@ | ||
| pass: | ||
| - "Deployment.default.passing-selector-deployment" | ||
| fail: | ||
| - "Deployment.default.failing-selector-deployment" |
This file contains hidden or 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,12 @@ | ||
| metadata: | ||
| name: "Missing or empty containers in K8S Deployment" | ||
| id: "NOT_EMPTY_01" | ||
| category: "KUBERNETES" | ||
| scope: | ||
| provider: kubernetes | ||
| definition: | ||
| cond_type: "attribute" | ||
| resource_types: | ||
| - "Deployment" | ||
| attribute: "spec.selector.matchLabels" | ||
| operator: "is_not_empty" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.