SONARJAVA-6269 S1451: Rollback to empty default headerFormat#5588
SONARJAVA-6269 S1451: Rollback to empty default headerFormat#5588NoemieBenard merged 1 commit intomasterfrom
Conversation
SummaryChanges the S1451 rule's default header format from a multi-line template (with product/copyright placeholders) to an empty string. This enables SonarQube quality profiles to use empty headers without requiring explicit configuration overrides. Test cleanup removes now-redundant explicit What reviewers should knowKey file: Behavior impact: When the S1451 rule is applied without a custom Test changes: Removes manual Verify: Check that the two removed test assignments (lines 103 and 110) were only for testing the empty-header case and don't mask any other test expectations.
|
|
There was a problem hiding this comment.
LGTM! ✅
Clean, minimal change. The empty-string default correctly disables the rule until a header is configured — headerFormat.isEmpty() triggers checkExpectedLines(new String[]{}), which always passes the matches() check (0 <= lines.size()). No regressions for users who have already configured a custom header.
One follow-up worth doing (not a blocker): ClassDefaultHeader.java (unchanged) still contains the old placeholder template and carries the comment // Compliant (default header). With the empty default, the test at lines 114–118 now trivially passes for any file, making both the test fixture's content and that test case redundant with the ClassBlankLine/ClassNoBlankLine cases just above. Consider replacing ClassDefaultHeader.java with a bare Java file and renaming it to something like ClassAnyContent.java, or dropping the test case entirely.





Replace the template header with an empty string to allow setting an empty header in SQ quality profile.