Re:Parsing method body
-
20. července 2005 18:51Hi
I am trying to parse a method body in a custom rule for FXCOP and filter some words.
e.g.
void SomeMethod()
{
statement1;
statement2;
statement3;
}
The method.Body.Statements
does not contain the text of the statement.
Is there any other method to get the result?
Thanks
Všechny reakce
-
21. července 2005 2:55
FxCop is a binary checker. The abstract syntax trees exposed by Method.Body are raised from IL. So, any information that's directly tied to source is lost. We are considering adding a source-based analysis in the future, but unfortunately it does not exist today.
Michael Fanning
VSTS Development: Code Analysis -
21. července 2005 15:54Thanks .
This means I can not filter some words and/or phrases from my code base by designing a rule, at present,right?
Rajan -
21. července 2005 17:20
That is correct. If you need to perform source-based analysis, you could consider writing a VS add-in and using the C# code model to do the work you're interested in.
Michael