xsharp.eu • XsDupFinder
Page 1 of 1

XsDupFinder

Posted: Sat Oct 10, 2020 5:10 pm
by VR
Hello.

I work for the same company as Arne and Hansjörg. In my spare time, I created a small tool called XsDupFinder, that some of you might find useful. With XsDupFinder you can analyze x# source code for duplicate code fragments. You can download it from my github repository. I also created a small tutorial on how to use it and how to interpret the generated html file.

Let me know what you think about it.

Regards

Volkmar

XsDupFinder

Posted: Sun Oct 11, 2020 5:40 am
by wriedmann
Hi Volkmar,
if you are working with Arne, then we share a very similar weather today <g>.
Thank you four your tool - I have tested it over my greatest X# project now.
The output is very interesting and useful.
For a regular use an exclusion pattern would be a good thing - both excluding files and directories with regular expressions.
And also maybe an inclusion pattern: only files and directories to check - multiple and with regular expressions.
Wolfgang
P.S. the project I checked has 417 files (counted by your tool), in about 100 folders

XsDupFinder

Posted: Sun Oct 11, 2020 5:45 am
by Chris
Very nice, I tested it against some of my code that I knew had duplicates and I think it found them all! Plus several more that I was not aware of :)
Good job!

XsDupFinder

Posted: Mon Oct 12, 2020 9:39 am
by softdevo@tiscali.it
Thanks, very useful, nice idea,
Danilo

XsDupFinder

Posted: Mon Oct 12, 2020 6:51 pm
by ic2
Hello Volkmar,

Indeed very interesting. Our main duplicate code is g.i.prg and i.prg (whatever it may be, something to do with Visual Studio generated file I think and VS and Microsoft are master in duplicating everything multiple times). Other duplicates in my first tested project are only a few lines of code which one wouldn't make a common method for anyway. But I am convinced that in our VO projects there's a lot more, and I will run it soon from the XPorted X# exports.

Thanks!

Dick

XsDupFinder

Posted: Wed Oct 14, 2020 12:20 pm
by robert
Dick,

These files are generated for each XAML file. The .f.i.prg is for "interactive use" (inside VS) and trhe .g.prg gets created during the built process.

Robert

XsDupFinder

Posted: Thu Oct 15, 2020 9:36 pm
by ic2
Hello Robert,
robert wrote: These files are generated for each XAML file. The .f.i.prg is for "interactive use" (inside VS) and trhe .g.prg gets created during the built process.
Robert
Thanks for explaining. I keep wondering however why so many files (like these 2) are exactly duplicated.

I've got another such issue, not sure how to solve it. I've got a html help file + pictures in a subdirectory of the program directory, like this:

string cHelp = "HelpDataPhotOrganize" + Globals.cLang + ".html";

Helpdata are found perfectly regardless the installation. The program is submitted to the Windows Store so I have no control of the directory used.

But this also means that I have to duplicate this full HelpData directory; once in Debug and once in Release (if I want to see the helpfile in both modes).

What would be the best way to prevent this?

Dick

XsDupFinder

Posted: Thu Oct 15, 2020 9:46 pm
by robert
Dick,

Put the HelpData folder in your project and mark the files in that folder with "copy to output directory"

Robert

XsDupFinder

Posted: Mon Oct 26, 2020 7:04 pm
by VR
Hi.

thanks for the feedback.

@Wolfgang: I'll see if I can add an "include only" and "exclude" option. But since RegEx is kinda complicated, I'll probably use Glob which should be powerful enough.

@Dick: I have to check, if I can detect and automatically ignore these generated files, because duplicated code in generated files is not problematic.

regards

Volkmar