Curiously, communists probably had it better precisely because of how focused they were on the one "big" goal (communist revolution): Leninist parties in particular were very centralized, disciplined, and scrupulously avoided doing minor illegal things (vandalism, etc.) that could give the police a excuse, because Marxist-Leninist ideology generally believes that small-scale direct action is ineffective, and the vanguard party should keep its powder dry, so to speak, until they're in position to seize power in one quick move. Anarchists are much more decentralized, and have varying opinions about how to organize change, so there's much more scope for the cops to find someone who spray-painted or vandalized something, and via that argue that any group that person was part of is part of an "anarchist criminal cell" by transitivity (occasionally they get tired of waiting, and a police infiltrator will actively egg on more militancy).