The Visual Studio Tools for Unity team has open sourced the Unity Analyzers, a collection of Unity specific code diagnostics and code fixes.
The Unity Analyzers are shipped as part of the Tools for Unity and are enabled on Visual Studio and Visual Studio for Mac. The analyzers run inside Visual Studio.
Learn more from the Visual Studio blog.