If you complain to the city about the way your landlord takes care of your apartment--can he evict you?
You've got two sets of laws protecting you.
The first is state law. Civil code section 1945.2 prevents a landlord from evicting a tenant for 60 days where:
1--The tenant has filed a written complaint with a government agency.
2--Because of a complaint, the city, or other agency, has inspected the apartment and cited the landlord.
3--The tenant has won a lawsuit from the landlord because of the landlord's failure to keep the apartment in liveable shape.
Specifically, what the landlord can't do is take any action against a "troublemaking" tenant such as evicting him, raising his rent or cutting services.