XsDupFinder

This forum is meant for anything you would like to share with other visitors
Post Reply
VR
Posts: 102
Joined: Sun Aug 23, 2020 3:07 pm
Location: Italy

XsDupFinder

Post 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
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

XsDupFinder

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4899
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

XsDupFinder

Post 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!
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
softdevo@tiscali.it
Posts: 191
Joined: Wed Sep 30, 2015 1:30 pm

XsDupFinder

Post by softdevo@tiscali.it »

Thanks, very useful, nice idea,
Danilo
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

XsDupFinder

Post 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
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

XsDupFinder

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
ic2
Posts: 1858
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

XsDupFinder

Post 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
User avatar
robert
Posts: 4518
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

XsDupFinder

Post by robert »

Dick,

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

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
VR
Posts: 102
Joined: Sun Aug 23, 2020 3:07 pm
Location: Italy

XsDupFinder

Post 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
Post Reply