How do I automatically fail a nant build if NDepend query raises a warning

OK first some background. I am busy automating our build process. We run a mixture of Vs 2005 and VS 2008 both targeting platform 2.0. We use Nant to do our builds using the MSBUILD task to do the compile and Cruise Control .net to do our CI. Currently we treat all warnings as errors, fail the build if any FxCop rules fail (except a small subset that we disabled), fail the build if Simian detects any code duplication of more than 5 lines across all projects.

I have written NDepend CQL query to enforce a few rules that are hard to implement in FxCop. I want to fail the build if the number of lines in a method/class breach a certain limit. I also want to fail if the cyclomatic complexity of a method is too high.

I can easily run NDepend as part of my build. But I can't get the build to fail if my CQL queries return results > 0

So this is the question:

  • Has anybody tried something similar?
  • Is there a Nant task that supports this?
  • If there is a Nant task that calls NDepend, but doesn't fail the build is the source available so I can add this feature?
  • Thanks, Stephen


    What we do is actually have a powershell script run right after that parses through the output file, and throws a series of errors with an appropriate message depending on which condition it found. As soon as powershell throws an error the build fails.


    查看关于NDepend关键规则和构建失败的文档:http://www.ndepend.com/Doc_CI_CriticalRule.aspx

    链接地址: http://www.djcxy.com/p/37706.html

    上一篇: 检测间接依赖库

    下一篇: 如果NDepend查询引发警告,我该如何自动失败