Yes, all 3 answers below are accurate. If the new buyer is aware of the violations they may want to make necessary repairs to bring the property back to code, but that should not affect you as a rented. They may wait for your lease to be finished, or ask for your input...but your lease takes priority over any changes.
If you have a written lease, the new owners should abide by those terms. However, because of the code violation issues, it may be smarter to make an agreement with the landlord to move before the sale.