I'm surprised how many people think wearing shorts is okay. Many facilities require long pants. OSHA leaves it to management to weigh the hazards, but I believe liability coverage often comes down on the side of long pants.
See this PDF from a joint insurance fund in New Jersey.