There were many great films made, but the ones that actually got effected by the Hays Code were damaged by it. Forced to do dumb things like send Scarface to trial instead of having him get shot, put married couples in separate beds, it even kept them from making anti-Nazi movies. The problem the Hays Code had was the same problem internet filters have, they were hooked on concepts without paying attention to context. The Code said bad guys had to face justice, but the people running the Code didn’t understand that getting gunned down WAS justice. They didn’t want sex on film, but they didn’t understand that if a married couple has kids we already know they do it, separate beds won’t change that. So they forced stupid changes.
The people running the code may have had a better virtuous grasp of justice than those who think illegitimate violence is just.