Chicago and Illinois have a long history of crooked government. Maybe you’ve heard.

In one of the better moves to clean up their act, many local governments in the last 20 years have hired inspectors general — in-house snoops — to keep an eye out for corruption, as well as to look out for ways to spend your tax money more efficiently, wasting less.

It’s a good thing.

Just last week, we saw how well this can work out. City Hall’s inspector general, Joe Ferguson, rapped Mayor Rahm Emanuel on the knuckles for failing to make sure that people who do work for the city under contract get paid at least a certain base wage, as called for by ordinance. Ferguson discovered that city contractors were paying the higher wage, but their subcontractors were not.

EDITORIAL

What did Emanuel do? He agreed the rules were being violated. He promised to jump on the problem.

Now, for an excellent example of how it can all fall apart — how the credible work of an inspector general can be defied and thwarted — let’s turn to the Chicago Public Schools.

Rather than comply with CPS’ ethics code when making a particular hiring decision, the top boss there decided to go ethics shopping. Then, when the inspector general got wind of it, the big boss took steps to impeded the IG’s investigation.

As reported by Lauren FitzPatrick and Dan Mihalopoulos of the Sun-Times this weekend, CPS Inspector General Nicholas Schuler rapped CPS chief executive Forrest Claypool on the knuckles earlier this year for hiring a law firm, Jenner & Block, with whom the school district’s general counsel, Ronald Marmer, had a business relationship. The law firm was paying Marmer $1 million in severance over several years, even as Marmer was overseeing the firm’s work for CPS.

That’s a blatant conflict of interest, as spelled out in CPS’ code of ethics.

And it does not matter that Claypool was confident Marmer is a man of integrity who would never, gee whiz, bend the rules. The entire point of an ethics code is to set things up so that personal integrity is not the only bulwark against corruption.

The sequence of questionable events, as reported by the Sun-Times or alleged by Schuler, goes briefly like this:

Early last year, CPS ethics advisor Andra Gomberg warned the school board that it should not hire Jenner & Block because of the conflict with Marmer. Then, when the board hired Jenner & Block anyway, Gomberg’s boss, Joseph Moriarty, agreed there was a conflict. All three members of CPS’ Ethics Advisory Committee also warned that Marmer should not be supervising the law firm.

At this point, Claypool went ethics shopping, looking for a lawyer who might see things otherwise.

First, Claypool turned to Pat Rocks, a former CPS general counsel. Sorry, Rocks replied, but it looks like Marmer is violating the ethics code.

Then Claypool turned to James Franczek, a longtime CPS labor lawyer. Franczek saw a problem in the arrangement, too.

At this point, you might expect Claypool to bow to the judgment of others. An awful lot of people were telling him that Marmer should not be supervising Jenner & Block’s work for CPS.

Claypool should have ended the conflict right then. Most obviously, he could have replaced Jenner & Block with another law firm. Chicago has plenty of good lawyers.

Claypool, however, went ethics shopping one more time. He called a lawyer who has contributed to his past political campaigns, J. Timothy Eaton, and hit pay dirt. Eaton promptly wrote a letter stating that, in his view, Marmer was doing nothing wrong.

And Claypool hung his hat on that.

But then Schuler, made aware of the possible conflict of interest by a Sun-Times investigative story, began looking into matter, and Claypool was not helpful.

First, Claypool hired Eaton to represent the school board in the investigation of Marmer. Then Eaton, according to Schuler, turned around and told Schuler he couldn’t interview the other two lawyers — Rocks and Franczek — claiming “attorney-client privilege.”

Eaton also informed Schuler he could not interview Claypool or Marmer unless he, Eaton, also was in the room. Schuler says this is contrary to the practice when City Hall’s inspector general interviews of city employees. During those sessions, city lawyers are barred from the room.

Inspectors general don’t always get it right. We get that. They can be petty or sloppy or vindictive. But we don’t see any of that here.

We see a chief executive, Forrest Claypool, who does not like to be second-guessed. Even when he’s been told over and over again that he’s wrong.

And we see an inspector general doing his job.

Send letters to: letters@suntimes.com.