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

Clean, but not properly clean

9 Answers 94 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.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 24 Mar 2011, 12:20 PM
I'm in the process of patching some code in a number of WCF services that have never been visited by a JC user.

These methods have no ordering of methods at all.

My default cleaning profile is set to reorder the methods using the default ordering profile.

If I ctrl-shift-alt-F on a file, it does a number of things including removing unused using clauses and the like, but what it doesn't do is reorder the methods. However, if I ctrl-shift-alt-F a second time, it does.

A little odd.

-- 
Stuart

9 Answers, 1 is accepted

Sort by
0
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
answered on 24 Mar 2011, 07:13 PM
Where do you specify ordering?

I would love to have it sort like this
- Page LifeCycle
- Methods
- Properties
- Events
...and then sort each alphabetically

Wishlist is wrapping all those in #regions :)
0
Stuart Hemming
Top achievements
Rank 2
answered on 24 Mar 2011, 10:56 PM
Steve,

From the JustCode menu in VS select Options|Code Style|C#|Ordering.

You'll see what you can and can't get once you're there.

I've not really looked in to this too closely 'cos I don't use regions in my code (I don't like 'hiding' code), but I think that if you create regions, your code is ordered inside them.

-- 
Stuart
0
Stuart Hemming
Top achievements
Rank 2
answered on 30 Mar 2011, 09:03 AM
Anyone?

-- 
Stuart
0
Blagoev
Telerik team
answered on 06 Apr 2011, 09:19 AM
Hi Stuart Hemming,

I can reproduce this for alphabetic ordering option. If you have internal and public method the public one will be moved ahead of the internal one. Still this does not work for alphabetically similar elements option. Thats a bug and we will work on fixing that. I created a PITS 5407 for that. Thanks taking the time reporting this.

There are some problems when the file has regions in it and we decided to disable reordering in that case for now.

Best wishes,
Blagoev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Blagoev
Telerik team
answered on 06 Apr 2011, 09:19 AM
Hi Stuart Hemming,

I can reproduce this for alphabetic ordering option. If you have internal and public method the public one will be moved ahead of the internal one. Still this does not work for alphabetically similar elements option. Thats a bug and we will work on fixing that. I created a PITS 5407 for that. Thanks taking the time reporting this.

There are some problems when the file has regions in it and we decided to disable reordering in that case for now.

Best wishes,
Blagoev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stuart Hemming
Top achievements
Rank 2
answered on 06 Apr 2011, 09:25 AM
It might just be me, but I have a real thing about regions in code.

I understand the principle, I just hate having whole chunks of code hidden from me.

I'd like to see 'Clean' options to:
  1. remove all regions
  2. reorder (using the normal JC ordering rules) inside individual regions.

Option 1 for me, Option 2 for those who like to see these things in their code.

-- 
Stuart
0
Accepted
Blagoev
Telerik team
answered on 07 Apr 2011, 02:20 PM
Hi Stuart Hemming,
There is such request for removing regions. Also there is a stylcop waring about this, thats why many people want it. We will work on delivering such functionality.

As for reordering within regions there are some cases when thats event not possible. Consider this code
#region 
public void Start()
{
#endregion
....
}
this is legal and produces no errors on build. We are still considering all the odds about such a feature.

Thanks for sharing your thoughts.

Regards,
Blagoev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Stuart Hemming
Top achievements
Rank 2
answered on 07 Apr 2011, 03:23 PM
Please, Just Stuart will do.

Glad to hear you are considering a remove regions option.

FWIW, I think that this should include (as an option, at least) regions /inside/ methods. For example
void MyMethod()
{
  int i = 0;
 
  #region
  // let's just hide some code in here
  # endregion
 
  // more code
}

I see this in legacy code more often than I'd like and whilst it's not as bad as the example you shared (Gods, but do people /really/ do that?) it is still nasty.

-- 
Stuart

0
Blagoev
Telerik team
answered on 08 Apr 2011, 01:20 PM
Hello Stuart Hemming,
Thanks. We will provide such an option to remove regions in member body only. Good suggestion.

All the best,
Blagoev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Stuart Hemming
Top achievements
Rank 2
Blagoev
Telerik team
Share this question
or