Right-to-farm (RTF) laws or declarations are designed to protect farmers from nuisance suits and antifarming ordinances.
Wikipedia foundation.