@@ -126,9 +126,9 @@ def _scan_bullet_blocks(lines: Sequence[str], start: int, end: int) -> ScannedBl
126126 return ScannedBlocks (blocks_with_pos , i )
127127
128128
129- def read_text (path : str ) -> List [ str ] :
129+ def read_text (path : str ) -> str :
130130 with io .open (path , "r" , encoding = "utf-8" ) as f :
131- return f .read (). splitlines ( True )
131+ return f .read ()
132132
133133
134134def write_text (path : str , content : str ) -> None :
@@ -364,14 +364,16 @@ def _emit_duplicate_report(lines: Sequence[str], title: str) -> Optional[str]:
364364
365365
366366def process_release_notes (out_path : str , rn_doc : str ) -> int :
367- lines = read_text (rn_doc )
367+ text = read_text (rn_doc )
368+ lines = text .splitlines (True )
368369 normalized = normalize_release_notes (lines )
369370 write_text (out_path , normalized )
370371
371372 # Prefer reporting ordering issues first; let diff fail the test.
372- if "" . join ( lines ) != normalized :
373+ if text != normalized :
373374 sys .stderr .write (
374- "Note: 'ReleaseNotes.rst' is not normalized; Please fix ordering first.\n "
375+ "\n Entries in 'clang-tools-extra/docs/ReleaseNotes.rst' are not alphabetically sorted.\n "
376+ "Fix the ordering by applying diff printed below.\n \n "
375377 )
376378 return 0
377379
@@ -383,8 +385,15 @@ def process_release_notes(out_path: str, rn_doc: str) -> int:
383385
384386
385387def process_checks_list (out_path : str , list_doc : str ) -> int :
386- lines = read_text (list_doc )
387- normalized = normalize_list_rst ("" .join (lines ))
388+ text = read_text (list_doc )
389+ normalized = normalize_list_rst (text )
390+
391+ if text != normalized :
392+ sys .stderr .write (
393+ "\n Checks in 'clang-tools-extra/docs/clang-tidy/checks/list.rst' csv-table are not alphabetically sorted.\n "
394+ "Fix the ordering by applying diff printed below.\n \n "
395+ )
396+
388397 write_text (out_path , normalized )
389398 return 0
390399
0 commit comments