1
1
import re
2
2
import subprocess
3
3
import sys
4
- from pathlib import Path
5
4
from tempfile import NamedTemporaryFile
6
5
7
6
from pydantic import BaseModel , Field
@@ -26,7 +25,6 @@ def main(exclude_comment: str = 'pragma: no cover') -> int:
26
25
27
26
blocks : list [str ] = []
28
27
total_lines = 0
29
- cwd = Path .cwd ()
30
28
for file_name , file_coverage in r .files .items ():
31
29
# Find lines that are both excluded and executed
32
30
common_lines = sorted (set (file_coverage .excluded_lines ) & set (file_coverage .executed_lines ))
@@ -43,10 +41,10 @@ def add_block(start: int, end: int):
43
41
code_analysise = CodeAnalyzer (file_name )
44
42
45
43
if not code_analysise .all_block_openings (start , end ):
46
- b = str (start ) if start == end else f'{ start } - { end } '
44
+ b = str (start ) if start == end else f'{ start } to { end } '
47
45
if not blocks or blocks [- 1 ] != b :
48
46
total_lines += end - start + 1
49
- blocks .append (f' [link=file:// { cwd / file_name } ] { file_name } { b } [/link] ' )
47
+ blocks .append (f' { file_name } : { b } ' )
50
48
51
49
first_line , * rest = common_lines
52
50
current_start = current_end = first_line
@@ -64,8 +62,7 @@ def add_block(start: int, end: int):
64
62
console = Console ()
65
63
if blocks :
66
64
console .print (f"❎ { total_lines } lines marked with '{ exclude_comment } ' and covered" )
67
- for block in blocks :
68
- console .print (block )
65
+ console .print ('\n ' .join (blocks ))
69
66
return 1
70
67
else :
71
68
console .print (f"✅ No lines wrongly marked with '{ exclude_comment } '" )
0 commit comments