Hey @Yaro L.: I had a very similar situation on a house in Union City, with fines/violations (and also open permits). There are a few options that come to mind, but, as a general statement, this will take a *long* time, so hopefully there is no enormous pressure on your side or on the seller's side to get the house sold immediately (not that the seller could realistically expect that with tons of violations and fines anyways!):
First, you can buy the house notwithstanding the violations, open permits, etc. Obviously this is enormously risky because you'll then become liable for those violations and fines--but I'll explain below why this might be at least a conceivable option, if you are buying with cash/not a mortgage.
Second, more than likely, if you're getting a mortgage on the house, your lender will more than likely want to see some sort of CO or CO equivalent (in Union City it's a "No CO" letter)--regardless they probably wouldn't give you a loan if they know that there were outstanding fines/violations that perhaps exceeded the value of the house! The reality is that the city doesn't have an incentive to actually impose the full amount of the assessed fines, because they know that no future buyer/owner will ever be able to pay for them. Your best option is to therefore negotiate with the city to see if they will be willing to reduce the fines. I've done this before and is conceivable, but it requires BOTH the seller and buyer to be on board with this: obviously, you, because you're buying the house, and the seller, because they're currently liable for the outstanding fines. Normally the settlement agreement would stipulate something like: you and/or the seller pay a much reduced amount of fines (I think on one occasion it was agreed a > $500,000 fine would be reduced to $20,000) to the city and the city will drop the outstanding violation, in exchange you agree that you will actually remedy the violation(s) within a certain amount of time (apply for the appropriate permits and so on).
If you are confident that you can negotiate with the city and resolve it that way, it may be logistically easier to buy the house with the violations, and then resolve them aftewards (my first point)... but it's obviously MUCH safer for you to come to a binding agreement with the city prior to closing (that stipulates that the city gets paid for whatever they agreed to accept for the violations right after closing). Closing with the violations outstanding is probably only a viable option if the seller isn't interested in these negotiations, or the seller is a bank or etc. that is unresponsive.
Third, you may still have a problem, even with the violations resolved/a settlement agreement with the city, of open permits that delay that issuance of a CO or no CO letter. If you're buying this cash this is probably no big deal (in my opinion), though it would be nice to get a CO prior to closing. If you're buying with a mortgage you'll need to close or resolve these separately from the violations. The problem is that they may be related to whatever gave rise to the violations, but this is more of a building department issue, as opposed to the violations, which are more of a legal issue. Depending on the manner of the permits, you can usually have a licensed contractor sign an affidavit indicating the work was done satisfactorily, or you can actually call for an inspection. Probably the affidavit route is the best way to go, although you'll have to pay a non-trivial amount to get contractors to sign off on work that they didn't do ($500+ per trade in my experience).
Re: the violations--I know at least a few people in the city that you would need to speak to. It might also be advisable for you to hire your own attorney to negotiate with the city. Likely the first step will be speaking with the city attorney, in person if possible. Unfortunately I highly doubt that the building department will be of help in attempting to resolve this, unless you meet with the head of the building department, who will then likely just tell you more or less what I told you here). Send me a PM if you'd like and I can give you the contact info of a few people. (FWIW too: I am a lawyer but not your lawyer so these are just my general thoughts, not specific legal advice towards your situation!)
Best of luck!