Of course the company can fire her and from the sound of it should fire her. However, the lawyers might need to get involved in how to correctly document the performance problems in order to make the firing stick. The problem in the prior court case is almost certainly that the poor performance was not addressed or correctly documented or that others were allowed to make the same mistakes without being fired. Find out why the case was lost and then make sure you don't do the same thing again. But it should not mean you can't get rid of the incompetent.

In the meantime, stop enabling her poor performance. Treat her exactly as you would anyone else who is not performing. Be careful not to single her out, if others have performance issues or do the same things you complain about her doing, then make sure they too are treated the same way you treat her. Her disability isn't the problem, her sex isn't the problem. The way you let things slide without correcting them and insisting she do her job is a large part of the problem.

Tell her directly to commit code daily. When she does not, then write it up as a performance issue. Tell her that her attitude in taking everything personally is unacceptable and that you expect her to change. Do not worry about her self-esteem or psychological issues, that is her problem. Document that her unit tests are inadequate and that her code contains more bugs and that she takes too long to implement things. Put her on a performance improvement plan with the goal that she improves or goes. Document every single thing the company has tried to improve her performance.

If the lawyers say not to fire her, the best bet is to move her to a position where she can do less damage. Personally, I would consider giving her a make-work project to do that will be nice to have if she manages to complete it and no problem if it never gets done. Then have her work alone on it. Or give her a specific assignment that is not in the critical path of the project.

In the meantime, hire some well-qualifed women and disabled people. Once you have them in place and are rewarding their good work, it becomes more possible to fire the incompetent.

From some of the comments, it sounds as if the CEO of this company is also incompetent. He should have procedures in place to deal with performance problems and then follow them for everyone who has a performance problem (not just the disabled woman). The last court case should have convinced him of the need to do this.

For people who think this is not the compassionate route and that I am not understanding enough of her depression, I will point out that I have dealt with depression for almost 50 years. I am well aware of how it can impact your work.

Yes it is harder to work at a high level when you are depressed. That is a personal problem just like someone trying to work as an alcoholic or with severe pain or even while having chemo treatments. You can only accomodate so far and this person has in my judgement reached that limit.

If she can't contribute in any way to the business, then she is a charity case and the business is under no obligation to support that. The techinques I described are to help prevent lawsuits but the truth is this person is harming morale, she is causing better employees to leave, she is not contributing to the bottom line and she needs to be gone. The time for accomodation seems to be long past and from the description in the question, the company has tried very hard to get her to be productive. At some point you have to cut your losses.