fix: --skip-archived-repos does not filter correctly#157
Conversation
|
👋 @schmidlidev thanks for the PR! i'm looking at this today. i'm newly assigned to support of this project so i'm just getting up to speed on what's going on here. but i'm on the case! |
| // So re-slice the repos list if --skip-archived-repos is passed and the repository is in archived/read-only state | ||
| for i, repo := range repos { | ||
| // So filter the repos list if --skip-archived-repos is passed and the repository is in archived/read-only state | ||
| for _, repo := range repos { |
There was a problem hiding this comment.
if config.SkipArchivedRepos {
for _, repo := range repos {
if repo.GetArchived() {
logger.WithFields(logrus.Fields{
"Name": repo.GetFullName(),
}).Debug("Skipping archived repository")
// Track repos to skip because of archived status for our final run report
config.Stats.TrackSingle(stats.ReposArchivedSkipped, repo)
} else {
reposToAdd = append(reposToAdd, repo)
}
}
} else {
reposToAdd = repos
}
how about checking for the flag first, cut down on the extra reassignments if config.SkipArchivedRepos == false?
|
@schmidlidev thank you so much for the find here - i can see the logic before was overwriting the fact that skipped repos were skipped in future executions of the loop. nice find! i just had a nit that wasn't your doing, just now that we're looking at it, we can tidy up for more maintainable code. thanks again!! |
|
@schmidlidev Howdy. Just bumping this again in case you missed the message above. |
|
because this hasn't been updated in a bit, closing in favor of #169 |
Description
Fixes #158
Fixes filtering logic for
--skip-archived-repos. This logic was incorrect, causing some archived repos to be present in the result even though--skip-archived-reposwas passed.TODOs
Read the Gruntwork contribution guidelines.
Release Notes (draft)
Added / Removed / Updated [X].
Fixed a bug in the filtering logic for skipping archived repos.
Migration Guide
None