S1451 Track lack of copyright and license headers rule doesn't trigger on Pull Requests

  • SonarQube version: Developer Edition
  • Rule S1451 “Track lack of copyright and license headers” triggers on full project analysis, but potential issues are not shown in Pull Request decoration (and related Pull Request dashboard on SonarQube UI)
  • Steps to reproduce:
  1. Create repository and project on Sonar (with configured Pull Request Decoration settings)
  2. Add S1451 rule to Quality Profile (with proper parameters)
  3. Create Pull Request with new file that doesn’t contain copyright at the top
  4. Run sonar scanner with parameters set to that Pull Request.

Sonarqube will say that everything is fine, and code does not violate this rule.

I think, that rule S1451 doesn’t work in every language in pull requests. I’ve tested it for golang, java, ruby, kotlin.

1 Like

What you describe is a limitation we currently have in Pull Requests.
Since the issue doesn’t involve a line of code that was changed in the pull request, it’s no shown in the context of the pull request analysis.

1 Like

Thanks for answer. Do you plan to change this behavior in near future? We have many blockers in our projects because of this, and we have to write to developers to fix that, and that’s what exactly Pull Request validation and quality gates should do.
Do you have some list with rules, that are not triggering in pull requests? That would be very helpful.



We are facing the similar kind of issue with below rule and couple other rules on Developer Edition 8.5 for iOS.

swift:S1996:Types should be defined in separate source files

As [Wojciech Buczek] asked already, Could you please let us know the list of rules that won’t be trigged in pull requests but on main branch once merged.


1 Like

@venkat_ballem While we don’t have a list to share of all the rules that might not be raised on Pull Requests (depending on what has changed), you would probably like to vote for FR-9 - Short-lived branches and PRs should show all new issues, not just the ones on changed code :slight_smile: