dlidstrom / Duplo

Duplicates finder for various source code formats.
GNU General Public License v2.0
97 stars 21 forks source link

Output real block length (not only filtered) #26

Closed ArsMasiuk closed 4 years ago

ArsMasiuk commented 4 years ago

The following output says "set LineCount="10"" where '10' is "effective" length of the duplicated block (i.e. excluding empty lines, comments, defines etc.).

It would be nice to output real block lengths as well (i.e. with no excludes), for example like this:

<set LineCount="10"> <block SourceFile="/home/osboxes/Work/qvge/src/3rdParty/ogdf-2020/src/ogdf/uml/PlanRepUML.cpp" StartLineNumber="1201" LineCount="13"/> <block SourceFile="/home/osboxes/Work/qvge/src/3rdParty/ogdf-2020/src/ogdf/uml/PlanRepUML.cpp" StartLineNumber="903" LineCount="15"/>

dlidstrom commented 4 years ago

That looks like a good idea, if it helps your ui. Want to try it yourself?

ArsMasiuk commented 4 years ago

Well, I'm not so deep into Duplo's code yet... I'll take a look but this can require some time before I get closer.

Anyway this should be helpful for the visualisation first of all... To be honest, I think that absence of GUI makes this absolutely nice and useful utility very underrated (nowadays, the most of people no more want to bother themselves with a CLI, even on Linux...)

dlidstrom commented 4 years ago

I will see what I can do. Maybe I can find some spare tune an evening in the coming days.

dlidstrom commented 4 years ago

The xml output is now this:

<?xml version="1.0"?>
<duplo>
    <set LineCount="5">
        <block SourceFile="tests/Simple/LineNumbers.c" StartLineNumber="7" EndLineNumber="13"/>
        <block SourceFile="tests/Simple/LineNumbers.c" StartLineNumber="1" EndLineNumber="7"/>
        <lines xml:space="preserve">
            <line Text="AAAAA"/>
            <line Text="BBBBB"/>
            <line Text="CCCCC"/>
            <line Text="DDDDD"/>
            <line Text="EEEEE"/>
        </lines>
    </set>
</duplo>

I hope this is what you need @ArsMasiuk