MapCop v0.1

For some time now I've had a side project brewing called MapCop.  This program is a code-analysis tool for BizTalk Maps.  It works against the uncompiled .BTM files and will ensure a variety of rules are being observed ... eventually.

The project has been languishing, and tonight I forced myself to "just do it" and get MapCop to the point it would run at least 1 rule.  I've done exactly that.  This release, which is immensely alpha type release examines the structure of a map to ensure that every link between two functoids has its Label property set.  Nothing superbly exciting yet, but the structure exists to do alot more.

You can download the code and files here.

The rules are written to follow a simple interface which passes in the Map object and allows you to examine it, like so:

 

class LabelLinksMapRule : IMapRule{#region IMapRule Memberspublic List<MapError> AnalyzeMap(Map map){List<MapError> errList = new List<MapError>();foreach(MapPage loopPage in map.Pages){foreach(MapPageLink loopLink in loopPage.Links){if (loopLink.LinkFrom.DestinationType == LinkDestinationType.Functoid &&loopLink.LinkTo.DestinationType == LinkDestinationType.Functoid &&loopLink.Label.Trim().Length.Equals(0)){MapError newError = new MapError();newError.Page = loopPage;newError.Severity = ErrorSeverity.High;newError.Title = "Label all Links between functoids";newError.Description = "All links between functoids should have " + "their Label property set to ensure readability of functoid " + "parameter boxes.";errList.Add(newError);}}}return errList;}#endregion}