FxCop Rules For Sitecore

  0 rating
Developers
3/25/2014 7:31:30 AM
4/17/2015 1:39:43 PM

About

This module will allow you to integrate custom FxCop rules based on Sitecore best practices to improve your overall code quality.

Documentation

Documentation
  • Documentation > Getting Started
    Getting Started
    In the Bitbucket project you can either download the source file and compile, or you can go to the download page and get the Sitecore.FxCop.dll file out of the zip file.

    Add the Sitecore.FxCop.dll to your FxCop\Rules directory. By default, for FxCop 10, this is: C:\Program Files (x86)\Microsoft Fxcop 10.0\Rules.
    This will enable FxCop to run these rules every time FxCop is executed. 

    Alternatively, when FxCop is started, in the Rules tab additional rules can be added by right-clicking on the FxCop project. After this, select the Sitecore.FxCop.dll from where you've downloaded the dll file. 
    0
  • Documentation > Version 1.1
    Create your own
    If you think you have a useful rule, please feel free to add it and submit a pull request. 

    The source code can be found on BitBucket
    1
Back
Release notes
Version 1.0 Initial Release
Added the following rules:
- Use Sitecore.ContentSearch over Database.SelectItems
- Use Sitecore.ContentSearch over SelectSingleItem
- Get an item with ID over an item with a path
- Get fields by ID over fields by fieldname
- Get the raw value of fields through the FieldCollection over getting them through Fields
- Use MainUtil.GetBool over checking whether a checkboxfield is checked
- Use Sitecore.ContentSearch over ItemAxes.SelectItems
- Use Sitecore.ContentSearch over ItemAxes.SelectSingleItem
- Use Sitecore.ContentSearch over ItemAxes.GetAncestors
- Use Sitecore.ContentSearch over ItemAxes.GetDescendants
- Use UserSwitcher over SecurityDisabler

Version 1.1
A rule to detect if literals contain Sitecore paths has been added (Submitted by Mark Lowe)
Read more Back
Code examples

Solution screenshots(0)

Upload

Reviews (0)

Sort by: Date Most votes
  • Profile Avatar
    [fullName]

    Level: 0

    x0 x0 x0

    [date]

    [title]

    [text]

    Was this helpful?

    0

Comments (0)

Sort by: Date  Most votes

Leave a Comment

Comment must be field in
Post comment
loader

Write a review

Title can't be empty
Review can't be empty
Post review

Download

Title Description Download Action

Add File