Custom SitecoreCop validation without coding


I am working on giving a session on Code Analysis for Sitecore Projects. While gathering the content, I started preparing custom validations for SitecoreCop validation by Sitecore Rocks.  This blog post is to share how simple validations can be created using Sitecore Rocks without single line of code.

Required Setup:
  • Sitecore Installed
  • Visual Studio (I have VS 2013)
  • Sitecore Rocks extension
Steps
  1. Open Visual Studio and Open Sitecore Rocks explorer
  2. Connect to a Sitecore site using "New connection" option from Sitecore Rocks explorer
  3. Right click on the connected site and select Tools -> Validations as shown below
  4. Once in Validation tab, Click on "Edit Custom Validations". In the Custom Validations window, Click "Add" as shown below
  5. In the next window as shown in image below, we can create validations for
    • Sitecore items using Xpath/SitecoreQuery
    • web.config
    • expanded web.config (patched file)
    • Website file system and
    • Data folder file system
  6. Below image shows a simple xpath query to ensure website site comes before scheduler site. We can use the "Build" button to create the Xpath/ Sitecore Query. Fill the other elements of the form and press OK.
    • Condition - when should the validation trigger (simple when & not when option)
    • Severity (Haven't noticed any impact changing this though)
    • Title, Problem & Solution
  7. Newly added validation will be shown in Custom Validations window. Press "Close"
  8. Add new Validation Profile
  9. Select the rules to be run for the profile.
  10. Select the profile and Validate.
  11. Custom validation will trigger and will be shown below

This technique can be used to setup quick validations for below scenarios
  • Creating CM and CD validations.
  • SOLR/Coveo/Lucene configurations
  • Commerce server/ sitecore modules validations
References

Comments