Giter Site home page Giter Site logo

jericho / cake.stylecop Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ashthos/cake.stylecop

0.0 2.0 0.0 44 KB

Stylecop implementation for the CakeBuild build system.

License: MIT License

C# 68.43% XSLT 12.38% JavaScript 0.90% CSS 5.19% PowerShell 13.11%

cake.stylecop's Introduction

Cake.StyleCop

This is a thin wrapper around the standard StyleCop libraries which exposes StyleCop in a manner which can be used by Cake build scripts.

The .dlls included are available directly from The official StyleCop Project page

Note: Mis-reports some C#6 syntax as violations - this is due to the dll versions available. Once 4.7.55 is fully available from stylecop then this issue can be resolved.

#addin "Cake.StyleCop"

var target = Argument("target", "StyleCop");

Task("StyleCop")
  .Does(() =>
{
    // solution file
    var solutionFile = File("MySolution.sln");

    // stylecop settings file
    var settingsFile = File("Settings.stylecop");
    
    // xml results file
    var resultFile = File("StylecopResults.xml");

    // html report file
    var htmlFile = File("StylecopResults.html");

    StyleCopAnalyse(settings => settings
        .WithSolution(solutionFile)
        .WithSettings(settingsFile)
        .ToResultFile(resultFile)
        .ToHtmlReport(htmlFile)
    );
});

RunTarget(target);

Merging multiple stylecop result files

A second method is available if you need to merge several result files together to produce one report. This is useful for many CI servers

// html report file
var htmlFile = File("StylecopResults.html");

// reports 
var resultFiles = GetFiles("*.xml");

// will merge the xml files together before producing a single html file
StyleCopReport(settings => settings
    .ToHtmlReport(htmlFile)
    .AddResultFiles(resultFiles)
);

Customise the transform

There is a default xslt stylesheet which is used, but if you want to override this with your own, you can pass it to the settings in either method as follows

var xsltStyleSheet = GetFile("mystylesheet.xslt");

StyleCopAnalyse(settings => settings
  .ToHtmlReport(htmlFile, xsltStyleSheet)
);

cake.stylecop's People

Contributors

ashthos avatar miketonguk avatar symbianx avatar wwwlicious avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.