1. How to create a quality gate rule to capture copyright violations

Version: 9.7.1.62043
how is SonarQube deployed: Docker

How to create a quality gate rule to capture copyright violations.

Hey there.

What do you mean by “copyright violations”?

So basically, I would want sonarqube to analyze my code for any copyrights eventhough the copyright paragraph is removed.

Possible to add it as one of my quality gate?

I dont want to regular expression for this since it captures only if the copyright is present

There’s a rule for almost every language called Track lack of copyright and license headers which allows you to specify a regex pattern for your copyright header, and if it is not found on a file an issue will be raised.

This is a Blocker issue by default, so adding a QG condition like No Blocker Issues would fail your Quality Gate.

Thanks, I have added rule now.

Just to make it clarified, so, it expects copyright header for all my code and if it is not present it throws a blocker.

What if I copy a code from opensource and edit copyright as mine. Does Rule S1451 still detects

Yes

It’s not going to catch that this code came from open source – that would be impossible to detect. It will just check for the license header you specified in the rule.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.