Yep, that's my biggest beef. Not with the scattered bad cops, any group of sufficient size has bad people. Its how the larger group treats those who misbehave that make a difference in how that group is viewed by others. Since so many departments cover for bad behavior, it gives all of law enforcement a black eye.
Navy used to have the problem with pilots, the fighter jock mentality that led to showboating and flat hatting. And commands would cover for them in case of a crash, never rat out a fellow pilot. About the 1970s, the losses started getting out of hand and they forced a culture shift. And if you knew someone was doing that crap and failed to report it, you got the hammer too. Took about 8-10 years, but nowadays, pilots doing dangerous crap for kicks get weeded out pretty quick.
Until law enforcement does the same, it wil never get better. The Thin Blue Line is more like a mafia code of silence than anything else.