1717
1818from __future__ import annotations
1919
20+ from pathlib import Path
2021from unittest .mock import MagicMock
2122
2223import pytest
@@ -1131,6 +1132,12 @@ def test_trigger_analysis_uses_distinct_work_after_static_skip(self):
11311132
11321133
11331134class TestLicenseFiles :
1135+ @staticmethod
1136+ def _third_party_notice_range (start_line : int , end_line : int ) -> str :
1137+ notice_path = Path (__file__ ).resolve ().parents [3 ] / "THIRD_PARTY_NOTICES.md"
1138+ lines = notice_path .read_text (encoding = "utf-8" ).splitlines ()
1139+ return "\n " .join (lines [start_line - 1 : end_line ]) + "\n "
1140+
11341141 @staticmethod
11351142 def _range_content (range_index : int ) -> tuple [str , int ]:
11361143 canonical_lines , match_offset = static_runner ._LICENSE_CANONICAL_RANGES [range_index ]
@@ -1146,6 +1153,23 @@ def test_each_canonical_range_suppresses_only_ea3(self, range_index: int) -> Non
11461153
11471154 assert not any (f .rule_id == "EA3" and f .start_line == match_line for f in findings )
11481155
1156+ @pytest .mark .parametrize (
1157+ "start_line,match_line" ,
1158+ [(92 , 2 ), (118 , 2 )],
1159+ ids = ["mit_notice" , "bsd_notice" ],
1160+ )
1161+ def test_independent_third_party_ranges_suppress_ea3 (
1162+ self , start_line : int , match_line : int
1163+ ) -> None :
1164+ content = self ._third_party_notice_range (start_line , start_line + 2 )
1165+ findings = static_runner .run_static_patterns (
1166+ {"components" : ["LICENSE" ], "file_cache" : {"LICENSE" : content }},
1167+ [excessive_agency_module ],
1168+ )
1169+
1170+ assert static_runner ._is_license_boilerplate_line (content , match_line )
1171+ assert not any (f .rule_id == "EA3" and f .start_line == match_line for f in findings )
1172+
11491173 def test_review_payload_reports_ea3 (self ) -> None :
11501174 content = (
11511175 "Apache License\n Version 2.0, January 2004\n "
0 commit comments