A code of honor or honor code was set of ethical principals that governed a community.
According to Rojan, who was encountered by the USS Enterprise in 2268, the Kelvans claimed to live by a code of honor that was harsh and demanding, calling much from both the Kelvans and those they had conquered. (TOS: "By Any Other Name")
The Ligonians also lived by a code of honor which they used to test the crew of the USS Enterprise-D in 2364 in their first step towards establishing a treaty between themselves and the Federation. That year, their leader, Lutan kidnaped Tasha Yar to "achieve recognition for being daring and bold." The proper response to such an action was to "ask to get Tasha back," politely. When Lutan later refused to return Yar, Captain Jean-Luc Picard stated that "You speak of a code of honor, but what you are saying now, according to our customs, is called an act of war." When it was later decided that the Prime Directive was in effect on the matter, Picard made the comparison that "By our standards, the customs here, their code of honor, is the same kind of pompous, strutting charades that endangered our own species a few centuries ago." (TNG: "Code of Honor")