Skip to content
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

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

Merged
merged 4 commits into from
May 5, 2024

Conversation

doronkg
Copy link
Contributor

@doronkg doronkg commented May 3, 2024

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:

  • --include-namespace -> --include-namespaces
  • --exclude-namespace -> --exclude-namespaces

PR Checklist

  • This PR adds K8s exceptions (false positives)
  • This PR adds new code
  • This PR includes test for any new code

Github Issue

Resolves #178

Notes for your reviewers

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

@codecov-commenter
Copy link

codecov-commenter commented May 3, 2024

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 ⚠️
pkg/filters/options.go 0.00% 2 Missing ⚠️
pkg/kor/all.go 0.00% 2 Missing ⚠️

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

Additional details and impacted files
@@            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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@yonahd yonahd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

cmd/kor/root.go Show resolved Hide resolved
@doronkg
Copy link
Contributor Author

doronkg commented May 5, 2024

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.

Copy link
Owner

@yonahd yonahd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm
Thanks

@yonahd yonahd merged commit da2b1fe into yonahd:main May 5, 2024
1 check passed
@doronkg doronkg deleted the skip-non-namespaced-resources branch June 18, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kor all -n displays non namespaced resources
3 participants