Simplify qualifier comparison

Previously, the complexity of the qualifier comparison led to a single
method that was quite hard to understand.  This change simplifies that
method by breaking out smaller understandable and well-named chunks
with the same functionality.

[#50968083]
Merge 50968083-code-climate to master

[Completes #50968083]