Fix csharpsquid:S1117 SonarCloud warnings about shadowing fields with variable names #1042
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix csharpsquid:S1117 SonarCloud warnings about shadowing fields with variable names
Fixes #678
Description
This renames variables that shadowed fields of the same name, causing the SonarCloud S1117 warning. In the case of methods that replace static constructor initialization, this was named
result
instead of the field name. In other cases where there was no Lucene equivalent, the variable was renamed.This also fixes a bug in FieldInfos where there was the possibility of a KeyNotFoundException due to a coding oversight.
This investigation discovered a potential maintainability bug in
SortedSetDocValuesWriter.Flush
. Due to GetOrdCountEnumerable and GetOrdsEnumerable (previously named with a typo) having the same return type, their names were accidentally swapped. I fixed the typo in the names and fixed the names to match upstream. I also confirmed that the signature of AddSortedSetField expected them in this order.