Superheroes from both DC and Marvel are notorious for taking this to ridiculous extremes. The most obvious example is Batman's refusal to kill even The Joker, despite knowing that he's a purely evil, irredeemable, sadistic monster who cannot be reformed and who will simply go on killing innocent people just for kicks . When Joker then goes on to kill Jason Todd, the second Robin, Batman comes damn close to breaking his rule, but didn't in the end. Unfortunately, this would come to bite Batman later: when Superboy-Prime'sCosmic Retconresurrected Jason, the fact that Batman never avenged his death led him to assume the mantle of Red Hood, an Anti-Villain who opposes Batman's no-kill ideology, thus pitting the two of them against each other. Batman takes this to another extreme when his alter ego becomes a juror at the trial of someone captured by him. When asked if there's any reason he shouldn't be a juror, Bruce Wayne tells the judge that he's Batman. He later tells Tim that he had to tell because he was under oath.
The protagonists of Sin City each possess this trait. Despite their violent and sadistic nature, they will still put their lives on the line and suffer greatly for the sake of those they wish to protect.
When a character makes a decision and says, "I am adamant!", that means literally nothing, especially death threats, will make them change their mind. For instance, a swordsmith said this in refusing to sell one of his swords to a brutish samurai and when threatened to be killed, he all but said, "Kill me if you want, but that just guarantees I won't sell you anything."
Usagi sums up his feelings for this when he says "What fools we have in this world, that confuse honor for weakness."
More of a case of obsession before reason, but Rorschach from Watchmen has "Never Compromise" as his motto in the face or murderers and rapists, and the people who would stop him. This leads to his death as he refuses to allow Ozymandias to go free, despite that this would render the death of millions meaningless and restart the Cold War. However, he is also doing this because he does not want to allow the person responsible for the deaths of millions to walk off scot free, and he is disgusted with the idea that the only way to save humanity is to deceive and slaughter it.
In ROM: Space Knight, the title character found himself in such a situation when he had captured a disguised Dire Wraith disguised as a human scientist, but her security staff, unaware of her true nature, had arrived to help her. The Dire Wraith dared him to banish her at the cost that it will appear he killed her and he would likely never be able to convince humanity of the truth. Rom considers this, but since a friend had sacrificed his life to free his main weapon, he cannot have that sacrifice be for nothing. So, he banishes her and prepares to deal with the consequences.
Yorick of Y: The Last Man is like this for the first part of the series. Two major examples: He's the last living male human, yet tries not to cheat on his girlfriend who is half a world away. He comes across a town that's entirely populated by convicts from the near by women's correctional facility. Despite this, it seems to be one of the few nice places After the End and is actually very stable. Yorick wants to turn them in to the government.
The Transformers: There was the time Optimus Prime allowed himself to be destroyed because of a video game that he and Megatron were connected to in order to decide a battle. A game that he'd won, but by taking several NPCs out with Megs — something he'd never do in reality, so he considered himself the loser.
Further compounded by the fact that he killed the NPCs by accident. Given that they were in an opaque structure, Optimus would not have been able to know they were there either way. Nonetheless, Optimus declares that his victory was by cheating.
Linkara: That's not what 'cheating' is, you stupid truck!
Jubilee of the X-Men takes the superheroic code against killing to a foolish extreme in one story. While escaping from Operation: Zero Tolerance (who had been torturing her for days), she seriously injured one of the guards — and broke off her escape to perform CPR on him.
Jubilee: You wanna go around killing people? That's your choice. But don't think for a fraction of a second you're gonna make a murderer outta me.
Sunfire has the potential to be a genuine force for good, but often finds himself at odds with the X-Men and other heroes due to the situation at hand often conflicting with his fanatical loyalty to Japan and his family's reputation. The major reason he ends up joining the Uncanny Avengers is because he believes a Japanese hero being part earth's mightiest superhero team will bring honor and pride to his nation.
In Incorruptible - a spin-off of Irredeemable - Max Damage made a Heel–Face Turn in response to The Plutonian's epic Face–Heel Turn. In the process of "making a clean start of it", he destroys billions of dollars in currency he'd stashed away over the years and destroyed most of his old gear and hideouts. Which is cool and all, but wouldn't all those resources actually help fight The Plutonian?
Although the comic does frame this as the supervillainous equivalent of Going Cold Turkey, since Damage is trying to change his ways completely and feels that having the relics of his old life would make it too easy to slip back into old bad habits, same as a recovering drug addict doesn't keep a whole load of drugs stashed about the place just in case.
He also seemed to think that the best way to be a superhero was just to do the opposite of whatever he'd usually do as a villain in a case of Evil Cannot Comprehend Good. As he got better at heroics he started to be a bit more reasonable.
In the DC comic Birds of Prey, a group of Chinese uber fighters called the Twelve Brothers in Silk are said to be at Lady Shiva level of ability but routinely work for b-rate crime bosses by being challenged to defend their "honor." The claim being that they can't do the job, not that it's below them.
In the first WolverineLimited Series, Logan is aghast to learn that not only his girlfriend, Yashida Mariko, is married, but it was on the orders of her father which she obeyed without question. His friend makes it clear that she did it as a matter of personal honor and she literally would rather die than violate that. Logan goes to see her, but is frustrated that she is adamant about keeping her honor in obeying her father, even while her husband abuses her. Fortunately, Mariko eventually realizes that her father is besmirching their family's honor with his evil and plans to kill him and commit suicide in recompense. Fortunately, Wolverine beats her to it and Mariko considers the matter properly settled.
Then there's Spider-Man. With great power comes many low-paying jobs, no respect, a legendary chain of disrupted relationships and break-ups, and many, many injuries. But he never resigns for long. Because he's Spider-Man, and he has a responsibility.
In an early Avengers tale, the Swordsman joined the team as a mole in order to bring them down from the inside. When the time came to kill his teammates via a bomb provided by the Mandarin, Swordsman relented, stating that it would be cowardly and dishonorable to kill the Avengers while they slept.
When the Avengers are taking on the cosmic-powered Korvac, who's already killed a few of them, Yellowjacket suggests they use Korvac's love, Carina, for leverage and yells at Black Panther to grab her.
Panther: But...it would not be honorable!
Yellowjacket: To Hell with honor! How many more people have to die?
The odd case of the villain having this. More than once, Kang the Conqueror is asked why he doesn't just go back in time and kill the Avengers as children or stop them from ever being born. Kang's answer is that he considers the Avengers far too worthy opponents to defeat them by such an easy trick. He wants the satisfaction of defeating them in their primes and that just replaying his losses until he wins discredits any victory he might have.
In Jonathan Hickman's New Avengers, the Illuminati become aware of a cosmic Disaster Dominoes event — universes are colliding, Earth-first, and destroying each other — and that when two universes begin to collide, the event can be halted by destroying one of the Earths. Captain America is the only member of the group who will not entertain the idea of destroying a planet to save everything else so they wipe his memory and expel him.
In the first Marvel vs. DC/DC vs. Marvel crossover miniseries, Wonder Woman discovers The Mighty Thor's hammer and takes it up, becoming the God(dess) of Thunder. When Storm comes to challenge Wondy, she muses that she could easily defeat her with her new power, but discards it, finding it utterly unfair. Storm easily takes her down.
At the end of one story in Dracula Lives, Solomon Kane has Dracula at his mercy. Dracula reminds him that he owes him for saving his life earlier in the tale. Solomon grudgingly honors his request, and lets him go.
Geoffrey St. John in Sonic the Hedgehog: Despite knowing what his mentor Ixis Naugus is truly like, and even acknowledging that the wizard committed treason in a preceding arc, he still tries to make the whole "King Naugus" thing work and appeal to Naugus' better nature to work with the people of New Mobotropolis to help cure his illness. He gets betrayed when Naugus possesses him to escape his illness and manipulate said people. And possibly erased from existence following the crossover with the Mega Man book.
X-23 has increasingly been becoming this. Most notable in Wolverines, Laura, Daken and Blade subdue Siphon, a dangerous monster created by a Weapon X spinoff who feeds on the Healing Factors of other people, sometimes killing them in the process. Daken and Blade both want to put him down, and they would certainly be right to because of just how severe a threat he poses. However before he was experimented on, Siphon was a very intelligent, cultured, and kind man who was transformed into the monster he's become entirely against his will, with this part of his personality emerging whenever he's satiated and in control of his hunger. Laura talks them out of it, however, as she feels she and Siphon are Not So Different. She recognizes that he's a victim, and insists on doing the right thing and trying to help him. It eventually bites her on the ass. Mystique wanted Laura there when Daken confronted him for precisely this purpose, and unleashes an out-of-control Siphon on the group in the final issue, and he drains all of them.
In classic Western fashion Copperhead features both heroes and villains adhering to personal codes to their practical disadvantage.
Due to security concerns, Martineau is required to sign over her right to protection from the guards in order to interview Clay. Predictably, he takes her hostage. The guards ignore security protocol and insist on protecting her life by allowing him to escape, endangering many more lives.
Zolo swore to his dying father to protect his younger brother Nestor. Nestor proceeds to get himself into one dumb scrape after another, costing Zolo considerable energy and resources as his gang repeatedly bails Nestor out. The gang is sick of it and Zolo knows Nestor's a lost cause, but a promise is a promise.