StyleCop Breaking down the barriers to entry Gary Ewan Park Twitter: Blog:

Slides:



Advertisements
Similar presentations
Black marble the strategic IT asset for your organisation DEVELOPMENT LIFE CYCLE USING VISUAL STUDIO TEAM EDITION FOR DB PROFESSIONALS Richard Fennell.
Advertisements

Development Life Cycle using Visual Studio Team Edition for DB Professionals Richard Fennell Engineering Director SQLBits II Birmingham 1 st March 2008.
Stored procedures and views You can see definitions for stored procedures and views in the demo databases but you can’t change them. For views, expand.
Building Localized Applications with Microsoft.NET Framework and Visual Studio.NET Achim Ruopp International Program Manager Microsoft Corp.
Reducing development costs Code generation in IronSpeed Designer William Eastbury Simple Health & Beauty Limited.
SRDC Ltd. 1. Problem  Solutions  Various standardization efforts ◦ Document models addressing a broad range of requirements vs Industry Specific Document.
Neo.NET Entity Objects VisualStudio Tool Guide.
Visual Studio 2010 SharePoint Developer Tools. Developer Tools for SharePoint  Familiar VS Experience  Build, Debug, Deploy SharePoint projects  Visual.
BizTalk Deployment using Visual Studio Release Management
Visual Studio 2005 C# IDE Enhancements Luca Bolognese C# Program Manager Microsoft Corporation.
Visual Studio: Custom debugger visualizers. Creating Debugger Visualizers with Visual Studio : Introduction Code debugging is one of the most important.
How Static Code Analysis can change your life (for the better) Technical overview May 2008.
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
René Balzano Technology Solution Professional Data Platform Microsoft Switzerland Database Development with SQL Server Data Tools (SSDT)
Using Microsoft SharePoint to Develop Workflow and Business Process Automation Ted Perrotte National Practice Manager, Quilogy, Microsoft Office SharePoint.
Future Directions for Leveraging Advanced XML Tools and Building Custom XML Solutions Denise Draper DAT321 Microsoft Corporation.
Standards for Technology in Automotive Retail STAR Workbench 1.0 Michelle Vidanes & Dave Carver STAR XML Data Architects, Certified Scrum Masters.
Chapter 5 Using SAS ® ETL Studio. Section 5.1 SAS ETL Studio Overview.
Introduction to SharePoint Development with VS2010 Paul Yuknewicz Lead Program Manager
Branding and designing capabilities with the Design Manager MALIN DE SILVA SHAREPOINT SPECIALIST EXILESOFT, SRI LANKA.
Copyright © 2009 by SDL Tridion. SDL Tridion®, SDL Tridion R5™, BluePrinting™, SiteEdit™ and WebForms™ are trademarks of SDL Tridion Holding B.V. or its.
Branding in SharePoint #SPcincy2013 on Twitter Open wireless access is available. Feel free to Tweet (#SPcincy2013) and.
Doing Something Useful with Enterprise Library 3.0 Benjamin Day Level: Intermediate.
Creating and Running Your First C# Program Svetlin Nakov Telerik Corporation
Workflow and SharePoint Presented by Ben Geers. Overview What is workflow? Windows Workflow Foundation How does workflow apply to SharePoint? WSS v3 vs.
© FPT Software Code Review with VS © FPT Software Agenda What is Code review? Run Code analysis in VS 2012 Configuring Code Analysis rule set.
Virtual techdays INDIA │ Nov 2010 Developing Office Biz Application using WPF on Windows 7 Sarang Datye │ Sr. Consultant, Microsoft Sridhar Poduri.
1 ADVANCED MICROSOFT WORD Lesson 16 – Customizing Features Microsoft Office 2003: Advanced.
Extending ArcGIS for Server
Scalable Game Development William Roberts Senior Game Engineer
© BJSS Limited 2005 Commercial in Confidence Visual Studio 2008 Productivity Enhancing Tips and Resources Jeff Watkins – 25 September 2008.
Getting Started with Caliburn.Micro and Windows Phone 7 Gary Ewan Park Twitter: Blog:
DTS Conversion to SSIS Conversion Best Practices Mike Davis
Lecture 6: Computer Languages. Programming Environments (IDE) COS120 Software Development Using C++ AUBG, COS dept.
Farcry Not just a game anymore…. What is Farcry?  Farcry is a Content Management System (CMS)  It is designed to separate the jobs of site creation/design.
Doing Snippets in.NET Tuc Goodwin February Agenda What is a “snippet”? Where do I find Snippets? How do I use snippets? Demo How do I create a snippet?
Build Processes and Continuous Integration Automating Build Processes Software University Technical Trainers SoftUni Team.
Productivity with ReSharper Rasmus Kromann-Larsen.
Using Microsoft Visual Studio 2005 Original by Suma Rao Revised by John G. McMahon ( 9/6/2008 )
DEV303 ASP.NET: Leveraging Visual Studio.NET For Web Projects Tony Goodhew Product Manager Microsoft Corp.
Separating the Interface from the Engine: Creating Custom Add-in Tasks for SAS Enterprise Guide ® Peter Eberhardt Fernwood Consulting Group Inc.
Taking Control of Visual Studio through Extensions and Extensibility Anthony Cangialosi Senior Program Manager Lead Microsoft Corporation DEV311.
Open project in Microsoft Visual Studio → build program in “Release” mode.
This template uses Microsoft’s corporate font, Segoe Segoe is not a standard font included with Windows, so if you have not already done so, you need to.
Jump-Start WDSc-RSE by Robert Arce from PrismaTech. Jump-Start WDSc-RSE Presented by: Robert Arce.
Entity Framework Database Connection with ASP Notes from started/getting-started-with-ef-using-mvc/creating-an-
Integrating and Extending Workflow 8 AA301 Carl Sykes Ed Heaney.
1 BCS 4 th Semester. Step 1: Download SQL Server 2005 Express Edition Version Feature SQL Server 2005 Express Edition SP1 SQL Server 2005 Express Edition.
YOUR LOGO Phase 2 International Providing critical business software solutions at affordable prices.
SQL Server Reporting Services for.NET Developers Bret Stateham
Microsoft Expression Web - Illustrated Unit A: Getting Started With Microsoft Expression Web.
CIS-NG CASREP Information System Next Generation Shawn Baugh Amy Ramirez Amy Lee Alex Sanin Sam Avanessians.
Making the Most of Search in SharePoint 2013 Christina Wheeler.
Toni Petrina Microsoft MVP for C# Ekobit d.o.o. Controlling and extending development environment.
Assessing Code Quality and Technical Debt Using SonarQube
Stress Free Deployments with Octopus Deploy
Visual C# 2005: IDE Enhancements
Microsoft Connect /17/ :55 PM
Module 1: Getting Started
Microsoft® Office Word 2007 Training
Intro to Unit Testing with tSQLt
Microsoft Build /24/2018 4:02 PM © 2016 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY,
Using Visual Studio and VS Code for Embedded C/C++ Development
CIS16 Application Development Programming with Visual Basic
What's New in Visual Studio 2005
Introduction to VSTS Database Professional
Visual Studio Tools for Unity 2.0 Preview
DEV322 Visual Studio 2005 C# IDE Enhancements
Introduction to ASP.NET Parts 1 & 2
MS Confidential : SharePoint 2010 Developer Workshop (Beta1)
Presentation transcript:

StyleCop Breaking down the barriers to entry Gary Ewan Park Twitter: Blog:

Agenda What is StyleCop? Visual Studio Integration MSBuild Integration Using a Custom Task StyleCop Compliance Extending StyleCop Working with “Legacy” Applications Additional Tooling Support

Source Code

What is StyleCop?

A Definition… “StyleCop is an open source static code analysis tool from Microsoft that checks C# code for conformance to StyleCop's recommended coding styles and a subset of Microsoft's.NET Framework Design Guidelines. StyleCop analyzes the source code, allowing it to enforce a different set of rules from FxCop.” * Reference  *

What does that mean? StyleCop is a “plugin” for Visual Studio 2008, 2010, and VS 11 Preview (and in a way, 2005* and Express) It provides 162 rules over 7 categories of “style” *

Visual Studio Integration

Demo 1 Visual Studio Integration Using StyleCop on a New Project

MSBuild Integration

This gets installed by default… During the installation you have the option to install MSBuild files. These files will be required if you want to integrate StyleCop analysis with the Visual Studio build process or a Continuous Integration Server.

MSBuild Integration – Visual Studio To add StyleCop as part of the “Build” process in Visual Studio follow these steps: 1.Use the StyleCop.MSBuild Nuget package to install the necessary files and make file edits. 2.This edits the project file to include: 3.Add the following property in the project file to force all warnings to be treated as errors:

Demo 2 MSBuild Integration Including StyleCop Analysis as part of the Build Process

Using a Custom Task

MSBuild Integration – Custom Task StyleCop also includes a MSBuild task that can be used to create a custom build step Manning Publications – Continuous Integration in.NET

Demo 3 Using a Custom Task Running StyleCop Analysis as a custom task with MSBuild and TeamCity

StyleCop Compliance

Visual Studio Templates During the installation you have the option to install a new set of Visual Studio Templates, which will already by StyleCop “compliant”

Going further with more templates… Use StyleCop compliant code snippets Use StyleCop compliant project/item templates

Talk to your Team Get Buy-In from your Team Members Only enable the StyleCop rules that you want to follow Have a team meeting to decide

Demo 4 StyleCop Compliance Using StyleCop Compliant Project/Item Templates and Code Snippets

Extending StyleCop

Add More StyleCop Rules There are a number of projects that are extending the built- in StyleCop rules:  StyleCop+ o  JSL StyleCop o

Create your own Custom StyleCop Rule 1.Create a.Net Framework 3.5 Class Library Project in Visual Studio 2.Add a reference to StyleCop.dll and StyleCop.Csharp.dll 3.Create your analyzer class that inherits from SourceAnalyzer 4.Add an XML file with the same name as the analyzer class. Set the properties of the XML file to be an Embedded Resource and not copy to the output directory 5.Override the AnalyzeDocument method 6.You are ready to write your own analysis code

StyleCop Contrib This CodePlex Project started out life as another Custom StyleCop Rule Library, however, now it is a Unit Testing Framework for Custom StyleCop Rules Allows you to quickly begin testing your Rules, without the need to debug multiple instances of Visual Studio

Demo 5 Extending StyleCop Create a Custom StyleCop Rule and then test it with Unit Tests

Working with “Legacy” Applications

Using StyleCop in an Existing Project Turn off analysis for generated code Surround code in a region with the text ‘generated code’ within the title Turn off StyleCop Analysis for a particular file using SourceFileList in Settings.StyleCop file Turn off StyleCop Analysis for an entire project using Settings.StyleCop file

Demo 6 Working with “Legacy” Applications Turning StyleCop off for an existing large project using Settings file

Additional Tooling Support

Refactoring StyleCop Rules There are plugins available for both CodeRush and ReSharper to help refactor code to be StyleCop Compliant StyleCop For ReSharper  Now included as part of the core StyleCop installation  Automatically fixes 128 StyleCop issues during ReSharper “CleanUp Code…” Style Ninja for CodeRush  CR_StyleNinja CR_StyleNinja  Fixes 23 StyleCop Issues

ReSharper Integration During the installation you have the option to install ReSharper Integration files, these will be required if you want to be able to analyse and correct StyleCop warnings using ReSharper Refactorings.

Demo 7 Additional Tooling Support Using ReSharper to improve StyleCop Compliance

Questions? Feel free to me any additional questions at