Has the Catholic Church ever excommunicated someone based on their ideology? I know the Catholic Church excommunicates Catholics who join Freemasonic lodges, as well as Catholics who the Church judges to be willful heretics. But has the Church ever excommunicated a Catholic purely for being a member of a Communist or National Socialist party? The Church has never excommunicated Adolf Hitler, and some other Catholics who belong to Marxists groups, so I'm curious.
The Church has technically never reversed the decree excommunicating communists. 

More

However, it is no longer common practice to excommunicate individuals based on their political beliefs, and even directly after the decree was made, it was rarely enforced. Membership in Communist organizations or holding communist political beliefs is still considered a heterodoxy because it has been explicitly condemned by the Church, but it is no longer considered grounds for excommunication.

By the way, there were bishops who were excommunicated because they cooperated with the communists. You can read more about Chineses bishops.