Possible bug in r191

40 views
Skip to first unread message

zpcspm

unread,
Sep 24, 2008, 8:54:01 AM9/24/08
to Clone Digger general
Please see the uploaded file example-r191-1.py

It contains a chopped version of a big source file. The code doesn't
make too much sense, but there are no syntax errors. However,
CloneDigger shows a traceback when parsing this file:

Parsing example-r191-1.py ... done
4 sequences
average sequence length: 1.750000
maximum sequence length: 2
Number of statements: 7
Calculating size for each statement... done
Building statement hash... done
Number of different hash values: 4
Building patterns... 4 patterns were discovered
Choosing pattern for each statement... done
Finding similar sequences of statements... 2 sequences were found
Refining candidates... 1 clones were found
Removing dominated clones... 0 clones were removed
The following error occured during highlighting of differences on the
AST level:
Traceback (most recent call last):
File "/home/shadow/temp/cd/clonedigger/html_report.py", line 176, in
writeReport
rec_correct_as_string(s1, s2, u.getSubstitutions()
[0].getMap().values(), u.getSubstitutions()[1].getMap().values() )
File "/home/shadow/temp/cd/clonedigger/html_report.py", line 172, in
rec_correct_as_string
rec_correct_as_string(c1, c2, s1, s2)
File "/home/shadow/temp/cd/clonedigger/html_report.py", line 172, in
rec_correct_as_string
rec_correct_as_string(c1, c2, s1, s2)
File "/home/shadow/temp/cd/clonedigger/html_report.py", line 172, in
rec_correct_as_string
rec_correct_as_string(c1, c2, s1, s2)
File "/home/shadow/temp/cd/clonedigger/html_report.py", line 166, in
rec_correct_as_string
set_as_string_node_parent(t)
File "/home/shadow/temp/cd/clonedigger/html_report.py", line 161, in
set_as_string_node_parent
n = NewAsString(t.ast_node.as_string())
AttributeError: AbstractSyntaxTree instance has no attribute
'ast_node'
using diff highlight

Is this normal?

Peter Bulychev

unread,
Sep 26, 2008, 3:57:47 PM9/26/08
to clonedigg...@googlegroups.com
Hi.

Clone Digger tried to highlight the differences on the Abstract Syntax Tree level. For some reason it failed (later I'll take a look why), and finally it highlighted differences using string-based diff algorithm.

2008/9/24 zpcspm <zpc...@gmail.com>



--
Best regards,
  Peter Bulychev.

zpcspm

unread,
Sep 26, 2008, 4:36:22 PM9/26/08
to Clone Digger general
On Sep 26, 10:57 pm, "Peter Bulychev" <peter.bulyc...@gmail.com>
wrote:

> Clone Digger tried to highlight the differences on the Abstract Syntax Tree
> level. For some reason it failed (later I'll take a look why), and finally
> it highlighted differences using string-based diff algorithm.

I saw the code. I saw that the diff algorithm was used as a fallback.
I also saw that the traceback was printed by the script, on purpose.
If the fallback method is the normal thing that can happen in such
situations, I'm fine with it. Perhaps it would be better to not show
the traceback to the user then. But since the traceback was printed
manually, I've considered that it plays the role of a trace in the
code (to help identify potential problems that could occur during
highlighting). That's why I took some time to provide a reasonably
small code snippet that you could use to reproduce the traceback and
look into the problem.

Peter Bulychev

unread,
Sep 26, 2008, 5:29:21 PM9/26/08
to clonedigg...@googlegroups.com
Hi.

I meant: thank you for your bug report :)

I'll try to fix it :)

2008/9/27 zpcspm <zpc...@gmail.com>
Reply all
Reply to author
Forward
0 new messages