Whenever I buy a gun, I actually look at it before putting my money down.
On a revolver I cycle the gun through a full revolution, both DA and SA. I also check barrel-cylinder gaps, and take a look at the forcing cone. I pay attention to canted barrels, and sights that seem "off". I look at the fit and finish as well. I look at the interior of the charge-holes, check the extractor star, and look at the crane for problems. Takes only a few minutes, but has saved me big bucks.
On a semi-auto, I check fit and finish, and the condition of the magazine. I also make sure that it drops free, and locks up easily. I make sure that the slide-stop functions, that the sights are properly installed, and that the trigger functions in a manner that I can live with. I also check the slide for fit on the rails, the extractor for burrs and the internals for rough, or out-of-spec parts.
When it gets home, it is detail, stripped, cleaned and inspected closely, and lubed properly. Only then do I shoot it. Sometimes it doesn't help. I had a S&W Model 625 that broke the hand in the first shot. My Sig P229 fractured it's slide at about round 75. I also had an HKUSP45 that patterned at 10 yards, instead of grouping. HK finally replaced the barrel.
However, the inspection does give me a fighting chance of getting a serviceable gun. Late S&W revolvers tend to have lousy timing from the factory, and the forcing cones, and cylinders routinely need work to bring them into spec. I've also noticed that some of the polymer frames from manufacturers aren't quite as well executed as before. They look odd, just a little out of spec in various areas. Some are problems, others are just "odd".
Anyone who just "buys a gun" today, and then just goes out and shoots, deserves the problems that they get. Instead of whining, they might try educating themselves BEFORE they make a purchase.