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

Justcode extension order

8 Answers 52 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.
RR SoftSol
Top achievements
Rank 1
RR SoftSol asked on 05 Jun 2013, 11:51 AM

Hi all,

atm i'm trying to develop a justcode cleancode extension. It seems to work, but I think something is wrong with the order of execution.
I'm writing 2 codecleansteps. First is to comment all regions. Second is to uncomment all regions.
The order of the comment is 1, the order of uncomment is 99999.

Sadly the reordering of code still does not work if I enable the uncomment step. If I disable this step, it all works like a charm. Regions get uncommented and the code does get reordered.

Are the default telerik cleancode steps executed last, or am I doing something wrong?

I uncomment region like this:

public static void UnComment(this IComment line)
      {
          line.FileModel.ReplaceTextually(line.TextualCodeSpan, line.Text.ToLower().Trim().Replace("/*", string.Empty).Replace("*/", string.Empty));
      }    



Any ideas?

8 Answers, 1 is accepted

Sort by
0
Zdravko
Telerik team
answered on 06 Jun 2013, 12:55 PM
Hi Ramon,

 Thanks for contacting us.
I tried to reproduce your issue, but the Code Cleaner works as expected. I made a demo that represents the result.

I just want to ask you about the following sentence:

"Sadly the reordering of code still does not work if I enable the uncomment step. If I disable this step, it all works like a charm. Regions get uncommented and the code does get reordered."

How the regions get uncommented when you have disabled the step?
Thanks.

Regards,
Zdravko
Telerik
Share what you think about JustCode with us, so we can help you even better! You can use the built-in feedback tool inside JustCode, our forum, or our JustCode feedback portal.
0
RR SoftSol
Top achievements
Rank 1
answered on 06 Jun 2013, 01:22 PM
Hi Zdravko,

thanks for your respond.I've looked at your example, and I do get the same behaviour. Reformatting is working fine, just not the reordering of the code. For example. moving properties to the top of the file.

I know regions are a common issue with reordering, so my idea was as following:
- comment all regions as 1st step
- run all Telerik JustCode clean steps
- uncomment all region as last step

For that, I've written 2 custom codeclean steps in 2 separate codecleaning classes.
1 for commenting regions, Order = 1
1 for uncommenting regions, Order = 99999

If I run the above steps with both my custom codeclean steps, the ordering of the code does not work (the Telerik JustCode reordering).
If I disable my 'uncomment all region as last step' then it all works. Regions do get commented, and the code gets reordered as well.

So somehow my step conflicts with the reordering. So I wonder if it has something to do with the execute order of the steps. Or perhaps I replace the lines in the 'comment all regions as 1st step' wrong.

Here the code I use to comment the regions, and this is how it is called in the step:
public static void Comment(this IPreProcessorDirectiveLine line)
        {
            line.FileModel.ReplaceTextually(line.TextualCodeSpan, "/*" + line.Text.ToLower().Trim() + "*/");
        }
public override void ExecuteCodeCleaningStep(CodeCleaningStep step, FileModel fileModel, CodeSpan span)
        {
            fileModel.All<IPreProcessorDirectiveLine>()
                .Where(line => line.IsRegion())
                .ForEach(region => region.Comment());
        }


Note: I'm aware that I have no guarantee the regions will remain intact in the code, or that code I moved / reordered inside regions, but that is ok :).

Cheers,

R
0
Zdravko
Telerik team
answered on 10 Jun 2013, 11:02 AM
Hello Ramon,

 Yes, there is an issue when executing this combination of Cleaning steps and we are working on to investigate it.
So far, it seems that the issue is at our side, but we will write you back when we resolve it.
Thank you.

Regards,
Zdravko
Telerik
Share what you think about JustCode with us, so we can help you even better! You can use the built-in feedback tool inside JustCode, our forum, or our JustCode feedback portal.
0
RR SoftSol
Top achievements
Rank 1
answered on 10 Jun 2013, 11:04 AM
Hi Zdravko,

thanks for your respond, and for confirming the issue. I'll see forward once it is resolved.

Greets,

Ramon
0
Accepted
Zdravko
Telerik team
answered on 03 Jul 2013, 11:35 AM
Hi Ramon,

We made some fixes and the cleaning steps should work as expected.
Also some changes were made to some of the cleaning steps order and for example reordering is now set to 9000.
I will soon post an article in our online documentation with a list of the steps order.

Thanks.

Regards,
Zdravko
Telerik
Share what you think about JustCode with us, so we can help you even better! You can use the built-in feedback tool inside JustCode, our forum, or our JustCode feedback portal.
0
RR SoftSol
Top achievements
Rank 1
answered on 03 Jul 2013, 01:07 PM
Hi Zdravko,

thanks a lot, that is good news indeed. I look forward to see the documentation and to use the new version :).

Cheers,

Ramon
0
RR SoftSol
Top achievements
Rank 1
answered on 24 Jul 2013, 01:14 PM
Hi Zdravko,

is there any ETA on the documentation or internal build / release with the fixe(s)?

Thanks in advance,

Ramon
0
Zdravko
Telerik team
answered on 26 Jul 2013, 11:22 AM
Hi Ramon,

 I just noticed that there is an issue with the page contents. This is the page, but I have to renew the content. Most probably it will be ready for the next week.
Thanks.

Regards,
Zdravko
Telerik
Share what you think about JustCode with us, so we can help you even better! You can use the built-in feedback tool inside JustCode, our forum, or our JustCode feedback portal.
Tags
General Discussions
Asked by
RR SoftSol
Top achievements
Rank 1
Answers by
Zdravko
Telerik team
RR SoftSol
Top achievements
Rank 1
Share this question
or