The Qodana plugin for TeamCity lets you add static analysis to your build chain.
The plugin provides:
Integration with TeamCity test support
Smart and flexible build comparison
Pliable build failure conditions
The plugin lets you add the code quality checks in the TeamCity pipeline or even start from scratch with static code analysis.