If you are claiming that the building is uninhabitable due to the code violations (you don't say what they are) then you should give written notice to the LL with a reasonable time period to fix the violations. That probably works out to about 30 days anyway. Moreover, you have to have someplace to move.
Notwithstanding the foregoing, you could move out immediately if the furnace is broken or something has occurred that would pose an immediate health or safety hazard , like a roof that is ready to collapse. You must make a decision and be prepared to back it up in court if your LL sues you for the rent.
Clifford L Tuttle, Jr
Attorney at Law