I moderate a small community. When we introduced new moderators, we had to formalise the unspoken rules that governed our moderation habits.
Now, we follow guidelines instead of intuition. Writing things down forced us to think about our behaviour, and to discuss the flaws in our unspoken rules. It makes our behaviour more consistent, especially towards content we personally don't like.
A code of conduct can be just that. A formal, consistent rulebook for a community.
A code of conduct promoting civility should be sufficient.