I've recently been placed in charge of a software engineer who is considered a "problem" employee for a couple of reasons. The employee is not a capable people person. I believe he has a minor case of autism / Asperger's / something along those lines. You can have a conversation with him, but you can tell he isn't super comfortable, and it is difficult for him to collaborate on team projects.
On the other hand, he is a "10x" developer in the absolute best sense of the term. He works 10-12 hours a day, and while I've only recently begun managing him, I am given to understand that he produces not only a stupendous volume of code, but also that his work is thoroughly documented and well tested such that it can be handed off to other people very easily.
Finally, the guy has deep seated, problematic viewpoints. He isn't racist in an explicit way where he express dislike for certain groups, but he not infrequently says disparaging things like "I don't think it's a good idea to have someone of (whatever minority / gender / etc) do that". He is very matter-of-fact about it: again there isn't anything that you would describe as malice. He just views these things as facts and (I think) isn't socially capable enough to understand that, regardless of what he thinks, there are some things he should not say.
Due to his usefulness, and his general lack of interest in talking to people anyways, the solution has historically been to try to isolate him from people he is likely to offend, and just let him keep doing his own thing. However, I've recently had an incident where something offensive made its way into code documentation and got to someone who was upset enough by it that they felt it needed to be brought to my attention. This person was understanding: they knew that he didn't mean to harm, and that he didn't quite understand the emotional effects of his opinions, but they (rightly) expressed that it wasn't fair / acceptable / etc to have things like that in the code base, and to force them and others to deal with it.
I haven't got a ton of experience with dealing with people like this, and am kind of at a loss. My boss tells me we aren't considering firing him. In the meantime I've been going through his past code and any code he submits: things like this pop up very rarely, but I've found a couple others from past code (nothing since the incident, when I talked to him). I've discussed it with him, and he seemed to understand, but I can't imagine that no one else has had this sort of discussion with him before, and so I think repeated incidents aren't out of the question.
It's also worth pointing out that there are two important dimensions that need solving. First and most importantly, I need to make sure he isn't hurting anyone. But secondly, as long as he is my direct report, it is my job to help him progress personally and professionally. Therefore I also really want to try to help him change, or at the very least, learn to stop talking about these views. If he didn't have this problem, he would just be "the best software engineer I've ever seen" instead of "that weird racist code jockey," and since I'm stuck managing him I really would like to help him become the former.
As a side note: I know I sound a little more sympathetic to the guy than I typically am when dealing with views like his. Please understand that I am completely not ok with his viewpoints, and find them totally vile. That doesn't make me not have to manage him, and given that I want to find the best solution I can.