ndepend

Ndepend - exclude assembly in some ways but not others

岁酱吖の 提交于 2021-02-10 14:24:14
问题 I'm using NDepend to analyze a C# project that I'm in the middle of developing. I have most of my business logic and data access layers written, but right now, the only front end application that I have is a "quick and dirty" test application. So first off, NDepend has all kinds of issues with my test application. Nothing serious, just things like too many methods, too-long methods, etc. Since this is basically a throwaway application, I didn't want to spend a bunch of time refactoring it, so

Ndepend - exclude assembly in some ways but not others

两盒软妹~` 提交于 2021-02-10 14:23:13
问题 I'm using NDepend to analyze a C# project that I'm in the middle of developing. I have most of my business logic and data access layers written, but right now, the only front end application that I have is a "quick and dirty" test application. So first off, NDepend has all kinds of issues with my test application. Nothing serious, just things like too many methods, too-long methods, etc. Since this is basically a throwaway application, I didn't want to spend a bunch of time refactoring it, so

NDepend -Finding dead methods

自作多情 提交于 2020-01-03 17:42:08
问题 I have two public methods A & B. I modified CQL to show me methods which are public and dead. If B is only called by A and A is coming as dead method(not called or referenced anywhere in the application) can NDepend show both the methods as dead by doing some settings or by CQL? In current scenario I am getting only A as dead method not B. 回答1: can NDepend show both the methods as dead by doing some settings or by CQL? Yes, NDepend can do that thanks to Code Rule over LINQ Query (CQLinq)

nDepend querying direct indirect methods for all methods in an assembly

旧城冷巷雨未停 提交于 2020-01-02 17:33:46
问题 I am trying to retrieve all direct indirect method calls for all methods in an assembly using the CQL provided by nDepend. Issue is I am not able to iterate through all methods inside a assembly to get this info. The DepthOfIsUsedBy only allows a string type and not a collection of strings. Is there a way t get this info for all methods inside an assembly? 回答1: What about using the method DepthOfIsUsing() instead of DepthOfIsUsedBy() :o) from m in Assemblies.WithNameNotIn("nunit.uikit")

Detecting direct instantiation with nDepend

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 12:34:17
问题 With the nDepend API, would something like the following be possible? I want to keep a watch out for instances where our object factory has been bypassed and a concrete class is being instantiated directly. Obviously I'd need to be able to filter out things like: StringBuilder stringBuilder = new StringBuilder(); perhaps by adding to the Where clause type names to exclude, or namespaces in which to check, but I want to make sure we see: IMyCustomType item = ObjectFactory.Get<IMyCustomType>();

NDepend TypeInitializationExceptions when Testing with NUnit

给你一囗甜甜゛ 提交于 2019-12-24 06:38:42
问题 So I'm trying to set up a project using the NDepend API for some metrics on my code (Which works nicely), however, when I attempt to run a testing framework (NUnit) over it, I'm getting TypeInitializationExceptions thrown. Here is some code to reproduce the errors I'm getting: Create a class library project, and reference the NDepend API dll at $NDependInstallPath$\lib\NDependAPI , setting copy local to false . Create a class as follows: public class NDependProjectLoader { public void

Ndepend CQL to find methods of certain types using particular framework assembly

眉间皱痕 提交于 2019-12-24 00:38:36
问题 In order to check if types not derived from certain base classes are using a low-level framework assembly, the following query can be used. SELECT TYPES WHERE IsDirectlyUsing "ASSEMBLY:Framework.Data" AND !(DeriveFrom "App.BaseTypes.BusinessFacadeBase" OR DeriveFrom "App.BaseTypes.BusinessComponentBase" OR DeriveFrom "App.BaseTypes.DataAccessComponentBase") Now I wish to drill down further to see which methods from those classes are actually doing so. But the thing is if I change the query

CK metrics from C# project with Ndepend

断了今生、忘了曾经 提交于 2019-12-23 04:55:17
问题 I have project for school. Now I need to make from it report of all metrics CK (Chidamber Kemerer metrics). The report has to be like table of all those metrics. Question is how to make it from Ndepend this report which it generates it is not what I am looking for. Please help and say how to do it... maybe some tips, documents or something this is very important... 回答1: Ok, so if we are talking of these Chidamber Kemerer metrics, the NDepend ability to write Code Queries and Rules over LINQ

Only keep used types and remove unused types

对着背影说爱祢 提交于 2019-12-22 10:57:42
问题 Is there any way to remove unused types/code from a project. lets say I'm using NAudio (source code) in my console application and I'm only using the WaveIn class from it. Is there any way for me to remove unused classes from the code and only keep the WaveIn class and the classes WaveIn depends upon? Something down the line of tree shaking 回答1: Ndepend was the answer from t in Types let depth0 = t.DepthOfIsUsedBy("NAudioTrim.Program") where depth0 >= 0 orderby depth0 select new { t, depth0 }

Find all uses of a method (including via interface) using NDepend

廉价感情. 提交于 2019-12-22 05:01:01
问题 Using NDepend, how can I find all, direct and indirect, uses of a specific method or property? In particular, I need to find usages that occur via an interface somewhere along the use path. Thanks! 回答1: Right clicking a method anywhere in the UI, and selecting the menu: Select Method... > ...that are using me (directly or indirectly) leads to a code query like: from m in Methods let depth0 = m.DepthOfIsUsing("NUnit.Core.NUnitFramework+Assert.GetAssertCount()") where depth0 >= 0 orderby depth0