Choosing appropriate identifiers for the constructs in your code provides better readability and maintainability. With the latest build of Telerik JustCode you can now easily set naming conventions for all your code elements.
These rules can be set for C# and VB.NET and are part of the Code Style section of the JustCode options dialog:
These options are part of the shared settings so you can share them per solution as well.
There are seven types of rules that a user can choose from:
You can also disable the naming convention for a specific construct. Just choose “Disabled” from the rules combo box.
JustCode will analyze every identifier in your solution and will show a warning if the name of the construct does not match the specified naming rule:
An appropriate fix will be available:
There are some cases, in which you would like to set two rules for a construct, so that JustCode will accept either one of them when analyzing the name of the construct.
Consider the following case, where you want to have constants that are Pascal Case as well as constants that are UPPER_UNDERSCORE_CASE:
JustCode is showing a warning that the second constant does not match the naming conventions, because the naming rule for constants is set to “PascalCase”. You can, however, specify a secondary rule. To do so, click on the “Add” button in the Naming Conventions section or choose from the available context menu “Add Secondary Rule”. Save the chosen setting and the analysis will be refreshed automatically. The warning will not be shown anymore:
JustCode does not only show warning if the identifier of a construct does not match the chosen rule, but also uses the Naming Conventions when generation new constructs:
The Naming Conventions are also used in the quick-fixes that JustCode suggests:
That’s it for today. If you are eager to put your hands on these new functionalities, you can give Telerik JustCode a try! We hope you like what you see, much more to come. Your feedback is welcome and appreciated. Write to us in forum or support.
Our Q1 2012 Webinars are just around the corner. If you attend the What’s New in Tools for Better Code webinar, you can see live demos of the features mentioned in this blog post and much, much, more. One lucky winner from the Just* webinar will receive a Telerik Ultimate Collection worth $1999. More importantly, you will sharpen your ninja skills to write better code!
The JustCode team
Chris Eargle is a Microsoft C# MVP with over a decade of experience designing and developing enterprise applications, and he runs the local .NET User Group: the Columbia Enterprise Developers Guild. He is a frequent guest of conferences and community events promoting best practices and new technologies. Chris is a native Carolinian; his family settled the Dutch Form region of South Carolina in 1752. He currently resides in Columbia with his wife, Binyue, his dog, Laika, and his three cats: Meeko, Tigger, and Sookie. Amazingly, they all get along... except for Meeko, who is by no means meek.