Closed doronkg closed 3 months ago
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Attention: Patch coverage is 0%
with 4 lines
in your changes missing coverage. Please review.
Project coverage is 42.42%. Comparing base (
c70a3ac
) to head (f1c8cd0
). Report is 4 commits behind head on main.
Files | Patch % | Lines |
---|---|---|
pkg/kor/multi.go | 0.00% | 4 Missing :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
What this PR does / why we need it?
This PR fixes output overriding when using multi mode and grouping by namespace (default!). Assuming multiple unused resource types exist, only the last in the list will be displayed.
Regardless to the misfortunate output:
Example
```console $ kor sa,cm -n kor --group-by=resource kor version: vdev _ _____ ____ | |/ / _ \| _ \ | ' / | | | |_) | | . \ |_| | _ < |_|\_\___/|_| \_\ Unused ServiceAccounts: +---+-----------+---------------+ | # | NAMESPACE | RESOURCE NAME | +---+-----------+---------------+ | 1 | kor | test | +---+-----------+---------------+ Unused ConfigMaps: +---+-----------+---------------+ | # | NAMESPACE | RESOURCE NAME | +---+-----------+---------------+ | 1 | kor | test | +---+-----------+---------------+ ```Before fix
```console $ kor sa,cm -n kor --group-by=namespace kor version: vdev _ _____ ____ | |/ / _ \| _ \ | ' / | | | |_) | | . \ |_| | _ < |_|\_\___/|_| \_\ Unused resources in namespace: "kor" +---+---------------+---------------+ | # | RESOURCE TYPE | RESOURCE NAME | +---+---------------+---------------+ | 1 | ConfigMap | test | +---+---------------+---------------+ ```After fix
```console $ kor sa,cm -n kor --group-by=namespace kor version: vdev _ _____ ____ | |/ / _ \| _ \ | ' / | | | |_) | | . \ |_| | _ < |_|\_\___/|_| \_\ Unused resources in namespace: "kor" +---+----------------+---------------+ | # | RESOURCE TYPE | RESOURCE NAME | +---+----------------+---------------+ | 1 | ServiceAccount | test | | 2 | ConfigMap | test | +---+----------------+---------------+ ```PR Checklist
GitHub Issue
Closes #348
Notes for your reviewers
The root cause relies in the diff loop, and is outsourced to the namespace loop in case that's the requested output mode.