Campaign codes at colleges are swelling, and candidates are tripping over regulations. Rivals are quick to rat out each other

Kristina Smith and her friends didn’t know they were careening toward scandal as they danced to the music of Kanye West outside a Duke University dining hall in March, while distributing fliers promoting Ms. Smith’s run for student-government president.

The election police soon put a stop to the fun. The music came from an iPad, and someone snitched to the student-government attorney general—another Duke undergraduate—that the tablet violated Section 6 of the election code, which bars candidates from soliciting votes while...