This is a migrated thread and some comments may be shown as answers.

Naming Conventions

10 Answers 237 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Christian
Top achievements
Rank 1
Christian asked on 19 Jan 2012, 02:02 PM
Dear Community,

how can I create a Naming Conventions rule on Methods which match the following mehtod:

protected void BtnTest_Click (Object sender, EventArgs e)
{
    ...
}

I can't figure out how to configure it.

Kind regards
Chrstian

10 Answers, 1 is accepted

Sort by
0
Matt.F
Top achievements
Rank 1
answered on 19 Jan 2012, 02:36 PM
Same here, I disabled the method naming convention as there doesn't seem to be a way to make it match against auto generated / auto even wireup methods like the one you posted. Bit annoying really but there you go.

Matt
0
Stuart Hemming
Top achievements
Rank 2
answered on 19 Jan 2012, 04:01 PM
It's a bit sad that event code generated by JC itself doesn't use the Naming Convention settings; if you have Method Parameter naming set to PascalCase and JC generates, for example, an event handler, it always uses camelCase for the parameters.

--
Stuart
0
Ivan
Telerik team
answered on 19 Jan 2012, 04:17 PM
Hi,

Currently, you are not able to set a rule that matches the given method name.
However, we are going to introduce such a rule so that we can cover this case.
Besides disabling the method naming convention, there is another temporary workaround. You could introduce secondary naming conventions with suffix, for example "_Click" and use PascalCase as a rule.
 JustCode also follows the chosen naming conventions and generates code that matches the chosen convention. Not doing so in "Create Event Invocator" is clearly a bug and we are going to fix it as soon as possible.

All the best,
Ivan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Stuart Hemming
Top achievements
Rank 2
answered on 19 Jan 2012, 05:48 PM
Ivan,

Thanks for the update.

--
Stuart
0
Stuart Hemming
Top achievements
Rank 2
answered on 23 Jan 2012, 08:32 AM
On a related note, adding markup like this ...
<telerik:RadTreeView runat="server" ID="RadTreeView1" OnNodeClick="RadTreeView1_NodeClick">
Then using the JC visual aid to create the event results in this...
public void RadTreeView1_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
Which JC reports on saying the suggested name is RadTreeView1NodeClick.

--
Stuart


0
James Legan
Top achievements
Rank 1
answered on 23 Jan 2012, 08:51 PM
On the subject....

Is there anyway to use the new Naming Convention feature in clean-up to automaticlly apply the defined naming convention rules to existing code?
0
Ivan
Telerik team
answered on 25 Jan 2012, 09:41 AM
Hi,

@Stuart Hemming - In that case JustCode detects that the event handler that the user typed does not exist. That is why, JustCode suggests to create such a method. However, the user has already specified what the name should be and that takes precedence. We can only show a warning that it does not match the naming convention. It is up to the user whether to change it or not.

@James Legan - Currently, there is no code cleaning step for the naming conventions. However, there is such an item in our code base and we will consider implementing it.

Kind regards,
Ivan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Bill
Top achievements
Rank 1
answered on 16 Feb 2012, 03:40 PM
The JC Code Style is also enforced on designer-generated files. For example, if you create a new WPF project, you'll get a lot of code style warnings.

As we have no control over the naming conventions Microsoft uses, JC should NOT be scanning files generated by Visual Studio.

Because of this, I have disabled all the Code Styles; it is unusable as it is now.
0
Ivan
Telerik team
answered on 17 Feb 2012, 02:51 PM
Hi,

Thank you for your feedback. You can customize JustCode so it does not show errors or warnings from specific files. Here is a sample demo how to do this: http://screencast.com/t/tiTlDgmMA3.
JustCode also by default skips designer files.
If you have any more questions or remarks, please do not hesitate to contact us again!

Regards,
Ivan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Bill
Top achievements
Rank 1
answered on 17 Feb 2012, 10:00 PM
Thanks for the tip; that did the trick. I added the WPF files AssemblyInfo.vb and MyWpfExtension.vb to the exclude file filters.
Tags
General Discussions
Asked by
Christian
Top achievements
Rank 1
Answers by
Matt.F
Top achievements
Rank 1
Stuart Hemming
Top achievements
Rank 2
Ivan
Telerik team
James Legan
Top achievements
Rank 1
Bill
Top achievements
Rank 1
Share this question
or