Search for magic numbers using NDepend

Does anyone know how to find magic numbers in source code using CQL queries in NDepend? This is the same issue as this question , but I don't want to use regex if possible.

So, I want to find all the statements like

Int32 someValue = 23;
Double anotherValue = 1;

but not

for (int i = 0; i < array.length; i++)
+3
source share
2 answers

I confirm that NDepend and CQLinq are currently unable to handle this. I would advise you to make a small application using Mono.Cecil and look for magic numbers and strings. You will see that Mono.Cecil API rocks!

+1
source

, , , CQL.

+1

Source: https://habr.com/ru/post/1737509/


All Articles