I think this thread from the Violations forum is an excellent example of the incompetant installations we're talking about:
https://www.electrical-contractor.net/ubb/Forum4/HTML/000996.html

Looking at that, any of us can rattle off at least a half dozen codes he violated. Some of these would have been obvious to anyone with half a head on their shoulders- the whole can wiring, for instance. But, again, there is nothing complex here, just some lights and receptacles. It doesn't take a 5 year apprenticeship to do the kind of work this guy attempted- anyone who had taken a half hour to read the IRC's residential electrical section should easily have been able to do this correctly, including this guy. Might not have been pretty, but would be safe and legal.