Willy's Reflections

| Willy-Peter Schaub | Visual Studio ALM Rangers | In search of IT simplicity, quality and tranquility |

ALM Rangers – Raising the Quality Bar for Tooling (Part 1)

ALM Rangers – Raising the Quality Bar for Tooling (Part 1)

Rate This
  • Comments 1

When you ask the most pedantic and quality driven ALM Ranger to help you raise the quality bars, you are setting yourself up for an Epic adventure Smile

Jokes aside, Michael Fourie has not only been instrumental in the new ALM ranger documentation templates, but has become a feared reviewer for tooling and sample code. The former will be covered in a future blog post when we release the new Branching and Merging Guide, based on the new templates and styling. The latter, sample and tooling code review, is the focus of attention in this post.

The feared feedback

One N/A, one pass and five fails … not a result that is wished for, but one that shows just how pedantic (detailed and precise) the code review and how the quality bar has been set.

imageimage

 


Basic checklist

Our ALM Rangers Practical Ruck Training and Reference Manual outlines the process and checklists for all types of projects. The following image shows the checklist for Tooling projects, also used for selected sample code.

imageimage


What does it all mean?

Structural

The quality checks are made against the structure of the solution, whereby the image on the right shows the structure of the sample template solution that is included with the Ruck Guide.

1 - Namespace Allocation

All ALM Rangers code must make itself comfortable within the Microsoft.ALMRangers namespace.

Example –> Microsoft.ALMRangers.BranchTool.CmdLineParser;

2 - Linked Standard Filesimage

The standard files are included with the latest ALM Ranger templates and linked by solutions to inherit a consistent code analysis dictionary and common assembly information.

  • ALMRangersCodeAnalysisDictionary.xml
  • ALMRangersCommonAssemblyInfo.cs

Example: See code snippets at the end of this post.

3 - Local Standard Files

Each solution should contain 1 or more AssemblyInfo.cs files (example included at the end of post) which defines the title, description, product and version information.

Example: See code snippets at the end of this post.

Quality Gate

The second set of quality checks are concerned with the code itself and create most of the review errors and associated headaches.

4 - Code Analysis enabled in Release mode.

Code Analysis must be enabled in Release mode.
image

5 - ALMRangersRuleSet.ruleset

The solution projects must use the ALMRangersRuleSet.ruleset, which is listed at the end of this post.

6 - StyleCop

The solution code must pass StyleCop.

image

See http://stylecop.codeplex.com for more information. image

7 - ReSharper

ReSharper compliance is an optional, but recommended check. See http://www.jetbrains.com/resharper/ for information on ReSharper.


What’s the impact?

  1. DSCN8713We get to know the pedantic side of Michael Fourie when we ask him to do a “quick” review … there is only thorough and detailed in Mike’s vocabulary.
  2. Teams are usually faced with a image (FAIL) and image
  3. Teams then go into a quality improvement cycle.
  4. Eventually getting a image and shipping much better quality Smile

image The quest for code quality should not be an afterthought. Start on day one and your final review experience will be a much better one and overall less time, effort and anti-review-depressants are needed.

 


Source Code Samples

ALMRangersCodeAnalysisDictionary.xml

   1:  <?xml version="1.0" encoding="utf-8" ?>
   2:  <Dictionary>
   3:      <Words>
   4:          <Recognized>
   5:              <Word>Changeset</Word>
   6:              <Word>Changesets</Word>
   7:              <Word>Tfs</Word>
   8:              <Word>TFS</Word>
   9:          </Recognized>
  10:          <Unrecognized>
  11:              <Word>StyleCop</Word>
  12:              <Word>SourceFiles</Word>
  13:          </Unrecognized>
  14:          <Compound>
  15:              <Term CompoundAlternate="StyleCop">Stylecop</Term>
  16:              <Term CompoundAlternate="SourceFiles">Sourcefiles</Term>
  17:          </Compound>
  18:      </Words>
  19:      <Acronyms>
  20:          <CasingExceptions>
  21:              <Acronym>AWS</Acronym>
  22:              <Acronym>SSH</Acronym>
  23:          </CasingExceptions>
  24:      </Acronyms>
  25:  </Dictionary>
 

ALMRangersCommonAssemblyInfo.cs

   1:  // <copyright file="AssemblyInfo.cs" company="Microsoft Corporation"> 
Copyright © Microsoft Corporation. All Rights Reserved. This code released under the
terms of the Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)
This is sample code only, do not use in production environments</copyright>
   2:  using System.Reflection;
   3:   
   4:  [assembly: AssemblyCompany("Microsoft Corporation")]
   5:  [assembly: AssemblyCopyright("Copyright ©  Microsoft Corporation")]
   6:  [assembly: AssemblyTrademark("Microsoft Visual Studio ALM Rangers")]
 

AssemblyInfo.cs

   1:  // <copyright file="AssemblyInfo.cs" company="Microsoft Corporation"> 
Copyright © Microsoft Corporation. All Rights Reserved. This code released under the
terms of the Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)
This is sample code only, do not use in production environments</copyright>
   2:  using System.Reflection;
   3:   
   4:  [assembly: AssemblyTitle("Microsoft ALM Rangers ASSEMBLYTITLE")]
   5:  [assembly: AssemblyDescription("Microsoft ALM Rangers ASSEMBLYDESCRIPTION")]
   6:  [assembly: AssemblyProduct("Microsoft ALM Rangers PRODUCTNAME")]
   7:  [assembly: AssemblyVersion("1.0.0.0")]
   8:  [assembly: AssemblyFileVersion("1.0.0.0")]

ALMRangersRuleSet.ruleset

 

   1:  <?xml version="1.0" encoding="utf-8"?>
   2:  <RuleSet Name="ALM Rangers Rule Set" Description="These rules are a suggested minimal 
set to comply with for ALM Rangers code deliverables"
ToolsVersion="11.0">
   3:    <Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
   4:      <Rule Id="CA1301" Action="Error" />
   5:      <Rule Id="CA1400" Action="Error" />
   6:      <Rule Id="CA1401" Action="Error" />
   7:      <Rule Id="CA1403" Action="Error" />
   8:      <Rule Id="CA1404" Action="Error" />
   9:      <Rule Id="CA1405" Action="Error" />
  10:      <Rule Id="CA1410" Action="Error" />
  11:      <Rule Id="CA1415" Action="Error" />
  12:      <Rule Id="CA1821" Action="Error" />
  13:      <Rule Id="CA1900" Action="Error" />
  14:      <Rule Id="CA1901" Action="Error" />
  15:      <Rule Id="CA2002" Action="Error" />
  16:      <Rule Id="CA2100" Action="Error" />
  17:      <Rule Id="CA2101" Action="Error" />
  18:      <Rule Id="CA2108" Action="Error" />
  19:      <Rule Id="CA2111" Action="Error" />
  20:      <Rule Id="CA2112" Action="Error" />
  21:      <Rule Id="CA2114" Action="Error" />
  22:      <Rule Id="CA2116" Action="Error" />
  23:      <Rule Id="CA2117" Action="Error" />
  24:      <Rule Id="CA2122" Action="Error" />
  25:      <Rule Id="CA2123" Action="Error" />
  26:      <Rule Id="CA2124" Action="Error" />
  27:      <Rule Id="CA2126" Action="Error" />
  28:      <Rule Id="CA2131" Action="Error" />
  29:      <Rule Id="CA2132" Action="Error" />
  30:      <Rule Id="CA2133" Action="Error" />
  31:      <Rule Id="CA2134" Action="Error" />
  32:      <Rule Id="CA2137" Action="Error" />
  33:      <Rule Id="CA2138" Action="Error" />
  34:      <Rule Id="CA2140" Action="Error" />
  35:      <Rule Id="CA2141" Action="Error" />
  36:      <Rule Id="CA2146" Action="Error" />
  37:      <Rule Id="CA2147" Action="Error" />
  38:      <Rule Id="CA2149" Action="Error" />
  39:      <Rule Id="CA2200" Action="Error" />
  40:      <Rule Id="CA2202" Action="Error" />
  41:      <Rule Id="CA2207" Action="Error" />
  42:      <Rule Id="CA2212" Action="Error" />
  43:      <Rule Id="CA2213" Action="Error" />
  44:      <Rule Id="CA2214" Action="Error" />
  45:      <Rule Id="CA2216" Action="Error" />
  46:      <Rule Id="CA2220" Action="Error" />
  47:      <Rule Id="CA2229" Action="Error" />
  48:      <Rule Id="CA2231" Action="Error" />
  49:      <Rule Id="CA2232" Action="Error" />
  50:      <Rule Id="CA2235" Action="Error" />
  51:      <Rule Id="CA2236" Action="Error" />
  52:      <Rule Id="CA2237" Action="Error" />
  53:      <Rule Id="CA2238" Action="Error" />
  54:      <Rule Id="CA2240" Action="Error" />
  55:      <Rule Id="CA2241" Action="Error" />
  56:      <Rule Id="CA2242" Action="Error" />
  57:    </Rules>
  58:  </RuleSet>
  • Great work Mike F. and Willy and Bijan and... and... and team

Page 1 of 1 (1 items)
Leave a Comment
  • Please add 7 and 6 and type the answer here:
  • Post