Skip to content

consoleFull/html reporter shows wrong code block than line number gives #612

@kalashnlkov

Description

@kalashnlkov

Describe the bug
consoleFull/html reporter shows wrong code block than line number gives

To Reproduce
jscpd -r consoleFull --skipLocal --mode strict b/utsname.c a/utsname.c

Screenshots
error code block as following:

$ jscpd  -r consoleFull --skipLocal --mode strict b/utsname.c  a/utsname.c
Clone found (c):
 - b/utsname.c [6:27 - 16:1] (10 lines, 68 tokens)
   a/utsname.c [31:1 - 41:1]

Clone found (c):
 - b/utsname.c [6:27 - 16:1] (10 lines, 68 tokens)
   a/utsname.c [31:1 - 41:1]

 6  │ 31 │ ude <linux/uts.h>
 7  │ 32 │ #include <linux/utsname.h>
 8  │ 33 │ #include <linux/err.h>
 9  │ 34 │
 10 │ 35 │ // only in testing hahahha
 11 │ 36 │ static struct uts_namespace *create_uts_ns(void)
 12 │ 37 │ {
 13 │ 38 │      struct uts_namespace *uts_ns;
 14 │ 39 │
 15 │ 40 │      uts_ns = kmalloc(sizeof(

Found 1 clones.
Detection time:: 46.558ms

Expected behavior
output shows correct, full matched code.

Desktop (please complete the following information):

  • OS: Ubuntu
  • OS Version 18.04
  • NodeJS Version v16.20.2
  • jscpd version 3.5.10

Additional context
b/utsname.c

#include <linux/export.h>
#include <linux/uts.h>
#include <linux/utsname.h>
#include <linux/err.h>

// only in testing hahahha
static struct uts_namespace *create_uts_ns(void) // line 6 here.
{
        struct uts_namespace *uts_ns;

        uts_ns = kmalloc(sizeof(struct uts_namespace), GFP_KERNEL);
        if (uts_ns)
                kref_init(&uts_ns->kref);
        return uts_ns;
}

a/utsname.c contains function implement in b/utsname.c

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn issue contains information about wrong behaviour

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions