I started working today on creating a rule in FxCop to enforce the use of curly braces on if and for statements. I know that FxCop is built to analyze IL, not source code, so this should be an interesting experience. I’ll blog about it if I’m successful.
UPDATE: I was correct about FxCop not reading the source code. So I was unable to enforce the curly brace rule. I was able to create a custom rule although it was a painful exercise.
The problem with custom FxCop rules is that Microsoft really doesn’t document how to do it. I sent an e-mail and got a very prompt reply from Brad Abrams, Krzysztof Cwalina, and David Kean. The final response I got about the curly braces was from David Kean:
Unfortunately, you will need to parse the source yourself, FxCop (even with the PDB) doesn’t provide enough information. Braces (like whitespace, comments, etc) are a source-only construct.
Here are some of the websites that I used to write the code.
http://blogs.interknowlogy.com/timmccarthy/archive/2007/02/13/11543.aspx
Я считаю, что Вы не правы. Могу отстоять свою позицию….
Помощник юриста I started working today on creating a rule in FxCop to enforce the use of curly braces on if and for statements…..
Trackback by Alex Gordon — April 3, 2010 @ 6:38 am
По моему мнению. Вы ошиблись….
Начальник службы по эксплуатации холодильного оборудования I’ll blog about it if I’m successful.
UPDATE: I was correct about FxCop not reading […….
Trackback by Kylie Batt — April 20, 2010 @ 10:33 pm
Я считаю, что Вы не правы. Я уверен. Предлагаю это обсудить. Пишите мне в PM, поговорим….
Этимологический словник російської мови. В 4 т. Т. 3 (Муза – СЯП) I started working today on creating a rule in FxCop to enforce the use of curly braces on if and for statements…..
Trackback by Kylie Batt — May 3, 2010 @ 4:26 pm