John McCain's reputation as "honorable" emerged in 2000 in contrast to the politic, smooth-talking candidacy of George W. Bush. He maintained the posture of a gadfly throughout Bush's presidency, and Democrats opportunistically praised him for it because they hated the president.

Obama and his supporters decried McCain’s tactics. Yet some of the strongest criticism came from people whom McCain revered or who had long revered him...It was about the very nature of John McCain. In their eyes, at least, their hero was losing not only an election but his reputation—or, as one prominent backer put it, “his soul.”

As readily as they declared McCain honorable, Democrats retracted the compliment. Because he was their opponent, McCain's numbers were miserable for most of Obama's presidency, hovering at 42% by 2013.

It was only in the Trump era, after his sensational vote against an Obamacare repeal bill, that McCain won back a majority of Democrats, with numbers surging to 71%. Once again, Democrats declared him a man of honor and principle; once again, it just so happened that McCain was perceived as a foil to a Republican president.

Samuel Farber, writing for Jacobin, argues that "It was that sense of honor that many liberals found admirable, making them willing to overlook McCain’s hard-right politics and praise him upon his death."

The truth, however, is probably much more mundane. When it was in their partisan interest to do so, liberals praised McCain as an honorable man - and when it was against their partisan interest to call him honorable, liberals attacked him as a dishonorable sellout. Republicans, of course, behaved identically. There is not very much evidence that "honor" acted as some kind of of deeply-rooted cultural force that either impeded or enhanced John McCain's power; as far as I can tell, it was just a vacuous rhetoric that people used to articulate the predictable preferences of partisan politics.