Sonar reporting copyright comments as duplicate code

468 views
Skip to first unread message

Michael Giroux

unread,
Sep 19, 2016, 3:52:52 PM9/19/16
to SonarQube
Our project files have a common copyright comment:
// Copyright 2016 ...

Sonar is flagging these as duplicate code.  How are we supposed to add copyright notices to our source without causing sonar issues?

G. Ann Campbell

unread,
Sep 20, 2016, 10:22:51 AM9/20/16
to SonarQube
Hi Michael,

To verfiy, are we talking about Java here?


Ann

Michael Giroux

unread,
Sep 20, 2016, 7:34:51 PM9/20/16
to SonarQube
Yes we are.

Freddy Mallet

unread,
Sep 21, 2016, 4:41:48 AM9/21/16
to Michael Giroux, SonarQube
Hi Michael,

There must be something special in your headers because otherwise we would always detect such duplicated comments and that would generate a huge amount of noise (the one that you're currently facing).

Coud you send us an example of such java file ?

Thanks
Freddy

On Wed, Sep 21, 2016 at 1:34 AM Michael Giroux <mlgi...@gmail.com> wrote:
Yes we are.

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/a79c7e3f-74a1-4427-93e1-e022cadcbbce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Freddy MALLET | SonarSource
Product Director & Co-Founder
http://sonarsource.com

Michael Giroux

unread,
Sep 22, 2016, 1:30:10 PM9/22/16
to SonarQube
Issue seems to have resolved itself. The sonar issues are no longer being reported on these files. If it happens again, I'll be sure to make a source file available.

Michael Giroux

unread,
Sep 28, 2016, 2:58:07 PM9/28/16
to SonarQube
Issue is back.

Here is the first few lines of the code raising he issue:

// Copyright (C) 2016 Choice Hotels International
// All Rights Reserved
package com.choicehotels.web.pc.util;


Except for the package statement, the other file(s) have the same first two lines.  The sonar issue is being marked on Line #1,

G. Ann Campbell

unread,
Sep 29, 2016, 7:52:26 AM9/29/16
to Michael Giroux, SonarQube
Hi Michael,

I just tried to set up a small reproducer and failed. Could you send one?

FYI, here's one of my sample classes:

// Copyright (C) 2016 Choice Hotels International
// All Rights Reserved
package foo;

public class A {
}


Ann

---
G. Ann CAMPBELL | SonarSource
Product Owner

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/tmSYutmUMY0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/03bdb3f2-4cff-4865-a769-3c4cddf85041%40googlegroups.com.

Adam Gabryś

unread,
Sep 29, 2016, 8:19:53 AM9/29/16
to G. Ann Campbell, Michael Giroux, SonarQube
Hello,
SonarQube always positions "duplication issue" in first line, but it does not mean that duplication is in first line ;-)
There are yellow vertical lines which show correct source code line (see attachment).

I reported an improvement idea some time ago: https://groups.google.com/forum/#!topic/sonarqube/um_SHikPkDs

Regards,
Adam Gabryś


From: ann.ca...@sonarsource.com
Date: Thu, 29 Sep 2016 07:52:24 -0400
Subject: Re: Sonar reporting copyright comments as duplicate code
To: mlgi...@gmail.com
CC: sona...@googlegroups.com
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
pmnkgfehkmfnmcng.png

G. Ann Campbell

unread,
Sep 29, 2016, 8:31:18 AM9/29/16
to Adam Gabryś, Michael Giroux, SonarQube
(facepalm)



---
G. Ann CAMPBELL | SonarSource
Product Owner

Adam Gabryś

To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages