yonahd / kor

A Golang Tool to discover unused Kubernetes Resources
MIT License
974 stars 91 forks source link

fix(GetUnusedAll): skip non-namespaced resources if --include-namespaces flag is used #258

Closed doronkg closed 4 months ago

doronkg commented 5 months ago

What this PR does / why we need it

Currently, when running kor all -n example, unused non-namespaced resources will be displayed as well. This PR fixes GetUnusedAll() function to skip non-namespaced resources if --include-namespaces flag is used. --include-namespaces flag is considered used if the amount of listed namespaces is greater than 0.

In addition, this PR fixes flag typos across the code/docs:

PR Checklist

Github Issue

Resolves #178

Notes for your reviewers

README.md was automatically lintered by IDE, hence newline changes were commited, etc.

codecov-commenter commented 5 months ago

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 43.45%. Comparing base (333b525) to head (53db71a). Report is 2 commits behind head on main.

Files Patch % Lines
cmd/kor/root.go 0.00% 2 Missing :warning:
pkg/filters/options.go 0.00% 2 Missing :warning:
pkg/kor/all.go 0.00% 2 Missing :warning:

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #258 +/- ## ========================================== - Coverage 43.60% 43.45% -0.15% ========================================== Files 58 58 Lines 2768 2775 +7 ========================================== - Hits 1207 1206 -1 - Misses 1382 1388 +6 - Partials 179 181 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

doronkg commented 4 months ago

One comment. We might want to later also support a flag for including cluster resources but I'm not sure if its needed.

We can have a follow-up in a discussion or create a backog issue for that. Like you, I'm not sure if its needed.