|
|
Version 2 Questions/Enhancements
Last post 06-24-2008, 4:01 PM by Serge B.. 11 replies.
-
11-12-2007, 5:12 PM |
-
grparry
-
-
-
Joined on 11-13-2007
-
-
Posts 16
-
Points 305
-
|
Version 2 Questions/Enhancements
Thanks for posting this beta version for feedback. Like others, I'm evaluating a few different options right now, including CodeIt.Right and the (fxcop) integrated code analysis in VS2005. I very much like that this can analyze source code. That said, here are my questions: 1) Any idea how much this tool is going to cost, per seat, or for a team of 10-15 developers? 2) I used the project wizard and created a custom rule project. How do I get it to show up in the Profile Editor? 3) It doesn't seem like there is a lot of flexibility around creating naming convention rules. I'm also looking at Visible Progress and they have a lot of flexibility around defining custom naming rules. I'm especially interested in defining some custom rules that support Hungarian notation. I know that Microsoft doesn't endorse this, but we have SO MUCH code that uses it, and I don't want to change it all. Maybe the SDK supports more flexibility than I think it does. I've downloaded the help file, but more complete documentation and some examples would be a big help. 4) Any plans for intellisense for rule checking/correction? 5) Any plans for automated generation of a document that lists all of the rules we have chosen. The hope would be that we could use this as our "Coding Standards" document. Thanks!
|
|
-
11-13-2007, 2:03 AM |
-
Serge B.
-
-
-
Joined on 01-27-2007
-
Seattle, WA
-
Posts 286
-
Points 2,865
-
|
Re: Version 2 Questions/Enhancements
Thank you for your feedback (sorry, you didn't leave your name) grparry:1) Any idea how much this tool is going to cost, per seat, or for a team of 10-15 developers?
It will cost in the range of $250 per seat. There will be team/volume discounts. grparry:2) I used the project wizard and created a custom rule project. How do I get it to show up in the Profile Editor?
All you need to do is place the compiled custom rule DLL into the rules folder - "C:\Program Files\SubMain\CodeIt.Right for VS2005\Rules\". Once the DLL is there it will be visible for the Profile Editor. To add rule to profile you need (if you haven't created a custom profile yet) to clone the built-in profile (Save As), or create new one (New) and then use the Add Rule toolbar command. grparry:3) It doesn't seem like there is a lot of flexibility around creating naming convention rules. I'm also looking at Visible Progress and they have a lot of flexibility around defining custom naming rules. I'm especially interested in defining some custom rules that support Hungarian notation. I know that Microsoft doesn't endorse this, but we have SO MUCH code that uses it, and I don't want to change it all. Maybe the SDK supports more flexibility than I think it does. I've downloaded the help file, but more complete documentation and some examples would be a big help.
What flexibility you are looking for? Can you please give me example(s)? Most of the rules developed to the date are targeting MS guidelines. With the exception of "Replace identifier prefix" and "Replace identifier suffix" - these are meant to help migrating from older naming convention style to newer. For example instance of "Replace identifier prefix" can be configured to replace "m_" prefix with "_" for local variables. We realize that many development teams (expecially with large existing code base) will choose to not use MS naming guidelines and stick with Hungarian notation. We have a set of rules on our list that will do prefix/suffix based on the code element type - these could be easily customized for Hungaran notation. As for the Visible Progress product - earlier this summer they suspended indefinitely further development of their .NET products - announced in the Dev Team News on their web site. (The SDK help file is not complete yet. Custom Rule and SDK tutorials are on the top of our list to publish. Meanwhile, you can use Reflector to review source code of any of the existing rules - CodeIt.Right rule libraries are not obfuscated) grparry:4) Any plans for intellisense for rule checking/correction?
Do you mean real time rule checking as you type? If so, it is not in our immediate plans. The reason is that would significantly slow down the Visual Studio because of the processor intensive rule processing. We may change our mind if we find an effective way of real time checking without overloading the system. grparry:5) Any plans for automated generation of a document that lists all of the rules we have chosen. The hope would be that we could use this as our "Coding Standards" document.
Yes, it is on our list for vNext. We are thinking of generating an XML document with a stylesheet (that would trun XML into a readable document) - very similar to the Violation Export report. Would this do?
Thank you, Serge Baranovsky http://submain.com - .NET Developer Tools | Microsoft VB MVP | http://vbcity.com - VB Developer Community » » (Static Code Analysis + Automatic Refactoring) / Painless Coding Guidelines = CodeIt.Right - http://submain.com/codeit.right » » C#/VB .NET Coding Guidelines - FREE 100+ page ebook (PDF) http://submain.com/guidelines
|
|
-
11-15-2007, 1:59 PM |
-
grparry
-
-
-
Joined on 11-13-2007
-
-
Posts 16
-
Points 305
-
|
Re: Version 2 Questions/Enhancements
Serge, Reflecting on the built-in rules assemblies helped a great deal. It now looks to me like it is possible to build any custom rule you want, with custom parameters that are available to the profile editor. Based on this, I made an attempt to create a rule that supported Hungarian naming conventions. My goal is to create a custom rule that works like your "Use or avoid certain prefixes" rule, but also supports data type-specific variable prefixes. I copied it to the rules folder, and the profile editor was able to detect the new DLL. The profile editor was also able to detect the custom parameters I added, including Serializable Enumerations. 1) I found that I was able to assign any arbitrary value to the "Category" attribute on the class definition. The profile editor would pick this up when browsing for new rules, but would not allow me to actually add the rule into the profile. It would be a useful feature to define additional categories if it's not too much trouble on your side. 2) Do you have any plans to build a test harness for custom rules DLLs? Unless I'm missing something, the test cycle is very cumbersome: - Update the rules DLL
- Shut down VS2005, so that I can move the new rules DLL into the Rules folder
- Attempt to run the analysis
- Look at the error reports generated by the error reporting pop-up
- Address the issue found
- Repeat
3) Initially, there were some coding errors in my DLL that generated exceptions (null objects, invalid parameters, etc). These errors were produced when the CodeIt.Right (CIR) framework was calling my Check function. I went through a couple of rounds of this (see #2 above). Then, the CIR framework starting generating a new error, which was that it could locate my assembly. I will try to attach the error report to this post, but if that doesn't work, please contact me via email and I will send you a file with the VS2005 output, and the output from the error report pop-up. 4) I'll have to think more about your plans for XML documentation of the Profile. My goal with this output would be to turn the coding standards into a bunch of HTML pages, and then link those pages into a Sandcastle Help File project (I'm using the Sandcastle Help File Builder, what a great tool!). I would like to embed the coding standards at the start of the generated internal documentation for our projects. 5) Now that I've gone through the architecture of your product in more depth, I think it's really well conceived. I'm struggling for where in your object model I can determine all of the attributes of the code (is it a class member variable? a local variable? a parameter? what is its type? etc.). However, I think some SDK documentation, or just some practice in dealing with your code object model (and looking at samples) will probably get me past this learning curve. 6) Have you thought about a place in your community site where people can post Custom Rules DLLs? It might be a great resource if people start sharing custom rules DLLs they have developed. 7) I noticed from Reflecting your built-in Rules that your classes specify a "FxCopMapping" attribute. I tried adding this to my assembly, and it seemed to work fine. What does it do? 8) Is there a method in the SDK that allows a custom rule to write output (logging) to the CodeIt.Right output window in VS2005? This would be a big help with debugging custom rules. Thanks, Grant
|
|
-
11-16-2007, 1:40 AM |
-
Serge B.
-
-
-
Joined on 01-27-2007
-
Seattle, WA
-
Posts 286
-
Points 2,865
-
|
Re: Version 2 Questions/Enhancements
Grant, grparry:1) I found that I was able to assign any arbitrary value to the "Category" attribute on the class definition. The profile editor would pick this up when browsing for new rules, but would not allow me to actually add the rule into the profile. It would be a useful feature to define additional categories if it's not too much trouble on your side.
We actually have this built in. It wasn't by accident the wizard allowed you to type custom Category name (be sure it doesn't have spaces though) - CodeIt.Right supports custom categories. It didn't work for you as there is bug in Profile Editor that you helped to pinpoint - it doesn't add rule that belongs to custom category. We will fix this ASAP. grparry:2) Do you have any plans to build a test harness for custom rules DLLs? Unless I'm missing something, the test cycle is very cumbersome: - Update the rules DLL
- Shut down VS2005, so that I can move the new rules DLL into the Rules folder
- Attempt to run the analysis
- Look at the error reports generated by the error reporting pop-up
- Address the issue found
- Repeat
You don't have to shut down Visual Studio - the Rules library is scanned every time you run Analysis. It will pick up your changes. Ans, yes, test harness sounds like a very useful feature for custom rules. Will add this to the list. grparry:3) Initially, there were some coding errors in my DLL that generated exceptions (null objects, invalid parameters, etc). These errors were produced when the CodeIt.Right (CIR) framework was calling my Check function. I went through a couple of rounds of this (see #2 above). Then, the CIR framework starting generating a new error, which was that it could locate my assembly. I will try to attach the error report to this post, but if that doesn't work, please contact me via email and I will send you a file with the VS2005 output, and the output from the error report pop-up.
I thought we fixed this and told you need to drop your custom rule to the "c:\Program Files\SubMain\CodeIt.Right for VS2005\Rules" directory. We will work on this. Meanwhile, there is another place you need to copy your dll - the Private Assemblies directory - "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies". Duplicating your changes in both places should address the "Unable to find assembly" issue. grparry:4) I'll have to think more about your plans for XML documentation of the Profile. My goal with this output would be to turn the coding standards into a bunch of HTML pages, and then link those pages into a Sandcastle Help File project (I'm using the Sandcastle Help File Builder, what a great tool!). I would like to embed the coding standards at the start of the generated internal documentation for our projects.
This sounds like a great idea. Let me know what are your further thoughts. grparry:5) Now that I've gone through the architecture of your product in more depth, I think it's really well conceived. I'm struggling for where in your object model I can determine all of the attributes of the code (is it a class member variable? a local variable? a parameter? what is its type? etc.). However, I think some SDK documentation, or just some practice in dealing with your code object model (and looking at samples) will probably get me past this learning curve.
Thanks, we've spent some time designing it (and re-designing too :) - we had a lot of fun working on this as well. if(elementInfo is IMemberInfo) { IMemberInfo m = elementInfo as IMemberInfo; if(m != null) { // m.ReturnType.Name will give you the data type information ... } } elseif(elementInfo is ILocalVariableInfo) { ... } elseif(elementInfo is ITypeInfo) { ... } For the complete list of interfaces see the SubMain.CodeItRight.Sdk.Reflection namespace in the SDK help file. grparry:6) Have you thought about a place in your community site where people can post Custom Rules DLLs? It might be a great resource if people start sharing custom rules DLLs they have developed.
Yes, this, in fact, was the main factor of picking the Community Server platform for SubMain Community site. There is no link to the download section yet - it will be enabled as we configure it and allow members to upload and share their custom rules. There will be a requirement though - the rules must be published with the source code - a security measure first of all. The download section can be accessed here - http://community.submain.com/files/ grparry:7) I noticed from Reflecting your built-in Rules that your classes specify a "FxCopMapping" attribute. I tried adding this to my assembly, and it seemed to work fine. What does it do?
A CodeIt.Right rule can be mapped to FxCop rule ID if they implement the same validation. Mapping (using the FxCopMapping attribute) allows CodeIt.Right, in addition to its own SuppressMessage attributes, respect FxCop/Code Analysis attributes and help with migration from FxCop/Code Analysis to CodeIt.Right. grparry:8) Is there a method in the SDK that allows a custom rule to write output (logging) to the CodeIt.Right output window in VS2005? This would be a big help with debugging custom rules.
There is no logging to the output window (although this is good idea and we will add this) but you can reference "c:\Program Files\SubMain\CodeIt.Right for VS2005\SubMain.CodeItRight.Core.dll" and then use SubMain.Core.ExceptionHandling.UnhandledExceptionManager.LogHandler(string message) - writes into the CodeIt.Right log file
or SubMain.Core.ExceptionHandling.UnhandledExceptionManager.LogHandler(string message, string fileName) - writes into a log file of your choice
Please keep me updated :)
Thank you, Serge Baranovsky http://submain.com - .NET Developer Tools | Microsoft VB MVP | http://vbcity.com - VB Developer Community » » (Static Code Analysis + Automatic Refactoring) / Painless Coding Guidelines = CodeIt.Right - http://submain.com/codeit.right » » C#/VB .NET Coding Guidelines - FREE 100+ page ebook (PDF) http://submain.com/guidelines
|
|
-
11-16-2007, 1:46 AM |
-
01-26-2008, 12:34 PM |
-
grparry
-
-
-
Joined on 11-13-2007
-
-
Posts 16
-
Points 305
-
|
Re: Version 2 Questions/Enhancements
Serge, I tried using the SubMain.Core.ExceptionHandling.UnhandledExceptionManager.LogHandler method, but it overwrites the file every time, leaving me with only the last line of output. Thanks, Grant
|
|
-
01-27-2008, 6:01 PM |
-
06-22-2008, 5:13 AM |
-
kkchan
-
-
-
Joined on 06-22-2008
-
-
Posts 14
-
Points 265
-
|
Re: Version 2 Questions/Enhancements
Hi, Thank you for reply. What if I want all TextBox Control use "txt" prefix, dropdown list use "ddl" prefix and etc? I tried to use rule UsePrefixForDerivedType to achieve it, but class node is disabled. Please advice. Thank you
|
|
-
06-22-2008, 9:07 AM |
-
06-22-2008, 9:52 AM |
-
Serge B.
-
-
-
Joined on 01-27-2007
-
Seattle, WA
-
Posts 286
-
Points 2,865
-
|
Re: Version 2 Questions/Enhancements
Please disregard the"class node is disabled" question. The reason the Class node is disabled for the UsePrefixForDerivedType rule is that rule only works with the targets that have a return type - Variable, LocalConstant, Method, Event, Property, Parameter, Constant, Field. To use with controls you want to select Field. A little explanation why you want to use UsePrefixForReturnType in your scenario. UsePrefixForReturnType - use it when you want to handle code elements of specific type. For example, when you want a prefix for System.Windows.Forms.TextBox type controls
UsePrefixForDerivedType - use it when you want to handle code elements of generic type. For example, when you want a rule to affect all controls (like in TextBox or drop down list being derived from System.Windows.Forms.Control). Another example would be a rule instance that is configured to deal with all custom controls that derive from System.Windows.Forms.TextBox
Thank you, Serge Baranovsky http://submain.com - .NET Developer Tools | Microsoft VB MVP | http://vbcity.com - VB Developer Community » » (Static Code Analysis + Automatic Refactoring) / Painless Coding Guidelines = CodeIt.Right - http://submain.com/codeit.right » » C#/VB .NET Coding Guidelines - FREE 100+ page ebook (PDF) http://submain.com/guidelines
|
|
-
06-22-2008, 6:28 PM |
-
kkchan
-
-
-
Joined on 06-22-2008
-
-
Posts 14
-
Points 265
-
|
Re: Version 2 Questions/Enhancements
Hi,
Thank you, it works if I uncheck "Exclude *.designer files" from Option | Exclude page. Anyway to have CIR parse field declaration section only (since UI control name is defined there) but exclude Windows Designer generated code section? I would prefer this option should be configurable by rule basis. It is because I have scenario that, some rule such as control naming convention rule required apply to *.designer file but other such as use _ prefix for private field is not required so.
Thank you
|
|
-
06-24-2008, 4:01 PM |
|
|
|