False positive code detection in a comment

  • ALM used: GitHub
  • CI system used: GitHub Actions
  • Java
  • False positive
  • It’s actually 2 errors:
    • It’s a false positive: there is no code in this comment, it’s just a license header
    • License headers should not be analysed in general. It may be slightly unconventional to put a license header under a package declaration, but that’s how Codehaus’s Maven license plugin does it, and it’s a popular one!
  • Use another license plugin that will place a header in a different place

Hi @asm0dey,

Welcome to the community,

Thanks for reporting the False Positive. It must be especially annoying in license headers.

I have created a ticket to fix the problem. In the meantime, a quick workaround is to remove the semicolon at the end of * Licensed under the Apache License, Version 2.0 (the "License");. This should prevent the issue from being raised.

1 Like

I changed the plugin that adds license headers, which is a valid solution in my smaller project, and is also a kinda workaround :slight_smile: However, it might be annoying in larger projects, especially given that Introduction – License Maven Plugin doesn’t use header files for predefined licenses, so it would be hard to manually remove semicolon (obviously possible with a simple shell script tho)

Thank you it is a good point, I was not aware of the predefined license headers.