auth0 / auth0-cli

Build, manage and test your Auth0 integrations from the command line
https://auth0.github.io/auth0-cli/
MIT License
243 stars 52 forks source link

Pass by value in for loop, not by reference. #953

Closed m3talsmith closed 8 months ago

m3talsmith commented 8 months ago

When getting --json output of a list of organization members, the entire list of members were duplicates of the last member found. The issue is this list where all entries were the duplicated member, rather than a list where all entries were unique members.

The problem was that there was a for loop that was passing a pointer to a loop variable, to a function, where it was being used later; passing by reference. This meant that the only value used was the last value in the loop, as the value of the pointer changed with each iteration.

🔧 Changes

This PR passes the value of the member to the function, forcing a copy of the current iteration value, and preserving it from changes by the next iteration: pass by value.

📚 References

🔬 Testing

📝 Checklist

codecov-commenter commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (859f796) 72.33% compared to head (b48438c) 72.33%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #953 +/- ## ======================================= Coverage 72.33% 72.33% ======================================= Files 92 92 Lines 12660 12660 ======================================= Hits 9158 9158 Misses 2959 2959 Partials 543 543 ```

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