@@ -282,7 +282,7 @@ def report(self, morfs: Iterable[TMorf] | None) -> float:
282
282
283
283
for fr , analysis in get_analysis_to_report (self .coverage , morfs ):
284
284
ftr = FileToReport (fr , analysis )
285
- if self .should_report_file ( ftr ):
285
+ if self .should_report ( analysis ):
286
286
files_to_report .append (ftr )
287
287
else :
288
288
file_be_gone (os .path .join (self .directory , ftr .html_filename ))
@@ -340,10 +340,10 @@ def make_local_static_report_files(self) -> None:
340
340
assert self .config .extra_css is not None
341
341
shutil .copyfile (self .config .extra_css , os .path .join (self .directory , self .extra_css ))
342
342
343
- def should_report_file (self , ftr : FileToReport ) -> bool :
344
- """Determine if we'll report this file."""
343
+ def should_report (self , analysis : Analysis ) -> bool :
344
+ """Determine if we'll report this file or region ."""
345
345
# Get the numbers for this file.
346
- nums = ftr . analysis .numbers
346
+ nums = analysis .numbers
347
347
self .all_files_nums .append (nums )
348
348
349
349
if self .skip_covered :
@@ -510,10 +510,13 @@ class PageData:
510
510
)
511
511
512
512
for region in region_list :
513
- if not region .lines :
514
- continue
515
513
outside_lines -= region .lines
516
514
analysis = ftr .analysis .narrow (region .lines )
515
+ # TODO: should_report updates counts that could instead be
516
+ # collected in PageData, and PageData could be used for
517
+ # index.html also.
518
+ if not self .should_report (analysis ):
519
+ continue
517
520
region_kinds [noun ].summaries .append (IndexInfo (
518
521
url = f"{ ftr .html_filename } #t{ region .start } " ,
519
522
description = f"{ ftr .fr .relative_filename ()} :{ region .name } " ,
@@ -522,12 +525,13 @@ class PageData:
522
525
region_kinds [noun ].totals += analysis .numbers
523
526
524
527
analysis = ftr .analysis .narrow (outside_lines )
525
- region_kinds [noun ].summaries .append (IndexInfo (
526
- url = ftr .html_filename ,
527
- description = f"{ ftr .fr .relative_filename ()} (no { noun } )" ,
528
- nums = analysis .numbers ,
529
- ))
530
- region_kinds [noun ].totals += analysis .numbers
528
+ if self .should_report (analysis ):
529
+ region_kinds [noun ].summaries .append (IndexInfo (
530
+ url = ftr .html_filename ,
531
+ description = f"{ ftr .fr .relative_filename ()} (no { noun } )" ,
532
+ nums = analysis .numbers ,
533
+ ))
534
+ region_kinds [noun ].totals += analysis .numbers
531
535
532
536
for noun , region_data in region_kinds .items ():
533
537
html = index_tmpl .render ({
0 commit comments