The Sitecore MVC Code Analyzer is a Visual Studio extension designed to help developers enforce best practices, identify performance issues, and maintain a clean architecture in Sitecore MVC projects. The extension automatically scans solution files, highlighting potential problems and suggesting improvements.
Currently supports VS2022.
Key Features
Detect GetItem() usage inside loops
Usage of GetDescendants(), which can cause excessive database queries
Sitecore Fast Queries, which directly accesses the DB to fetch results.
Detects improper use of catch/finally blocks when modifying Sitecore items, preventing unintended behavior
Checks for direct feature-to-feature references, maintaining Feature isolation
Identifies incorrect project dependencies, ensuring a modular and scalable architecture
🔍 Static Code Analysis
Performance Issue Detection
Identifies GetItem() calls inside loops, which can cause excessive database queries
Flags GetDescendants() usage, which can negatively impact performance
Detects slow Sitecore Fast Queries, ensuring optimal search performance
Helix Architecture Enforcement
Checks for direct feature-to-feature references, maintaining Feature isolation
Identifies incorrect project dependencies, ensuring a modular and scalable architecture
Code Quality Checks
Detects missing catch/finally blocks when editing Sitecore items
Highlights improper Sitecore API usage, preventing potential runtime issues