Justcode extension order

9 posts, 1 answers
  1. RR SoftSol
    RR SoftSol avatar
    13 posts
    Member since:
    May 2012

    Posted 05 Jun 2013 Link to this post

    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?

  2. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 06 Jun 2013 Link to this post

    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.
  3. DevCraft banner
  4. RR SoftSol
    RR SoftSol avatar
    13 posts
    Member since:
    May 2012

    Posted 06 Jun 2013 Link to this post

    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
  5. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 10 Jun 2013 Link to this post

    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.
  6. RR SoftSol
    RR SoftSol avatar
    13 posts
    Member since:
    May 2012

    Posted 10 Jun 2013 Link to this post

    Hi Zdravko,

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

    Greets,

    Ramon
  7. Answer
    Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 03 Jul 2013 Link to this post

    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.
  8. RR SoftSol
    RR SoftSol avatar
    13 posts
    Member since:
    May 2012

    Posted 03 Jul 2013 Link to this post

    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
  9. RR SoftSol
    RR SoftSol avatar
    13 posts
    Member since:
    May 2012

    Posted 24 Jul 2013 Link to this post

    Hi Zdravko,

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

    Thanks in advance,

    Ramon
  10. Zdravko
    Admin
    Zdravko avatar
    657 posts

    Posted 26 Jul 2013 Link to this post

    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.
Back to Top
DevCraft banner