I don't know what it should be a violation. Many boxes have clamps on the inside. Just deduct the appropriate amount from the box fill.

I do see how it might not be weatherproof.