The facts that you state in this question are essentially the exact facts presented to the Supreme Court of the United States in the case of Price Waterhouse v. Hopkins. This case was decided in 1989. The Court found that the company’s actions were illegal under Title VII of the Civil Rights Act of 1964.
The company’s actions in this case are illegal because they are based on sex or gender stereotyping. In other words, they are based on prejudices about how people of a given sex should act. The characteristics attributed to Rosie McDonald in this scenario are not characteristics that apparently apply to everyone. In other words, the company is not telling Ms. McDonald that she swears too much in absolute terms. Instead, it is telling her that she swears too much for a woman. It is holding her to different standards than men would be held to in terms of her actions and her appearance.
As interpreted by the Supreme Court in Price Waterhouse, Title VII of the Civil Rights Act of 1964 forbids employers from basing employment decisions on stereotypes about how people of a given sex should act. Therefore, McDonald has cause to sue.