This PR improves the heuristics to replace versions in bazel files, mainly focusing on maven/jvm.
The VersionOnlyHeuristic now doesn't blindly look for the version anywhere. It only looks for version quoted as a string. This is supposed to find the version if it is extracted to a constant. Heuristic only matches if it is the only occurrence. If there are more, we'd need more advanced parsing to figure out which library is it for.
This fixes the case when library that we try to update is not defined anywhere in code (for example it comes from another workspace as a constant), but there is another library that has the same version. Before this change, a completely unrelated library could be bumped.
Comments (strings after #) are ignored, and bazel-steward will not attempt to update a version in a commented code.
Changed ordering of heuristics, so that version only is treated as last resort.
This PR improves the heuristics to replace versions in bazel files, mainly focusing on maven/jvm.
This fixes the case when library that we try to update is not defined anywhere in code (for example it comes from another workspace as a constant), but there is another library that has the same version. Before this change, a completely unrelated library could be bumped.
Comments (strings after
#
) are ignored, and bazel-steward will not attempt to update a version in a commented code.Changed ordering of heuristics, so that version only is treated as last resort.
Refactoring of tests