Skip to content

Commit bf1a970

Browse files
committed
refactor: better style for constants
1 parent 68616f4 commit bf1a970

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

coverage/debug.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -610,24 +610,24 @@ def relevant_environment_display(env: Mapping[str, str]) -> list[tuple[str, str]
610610
A list of pairs (name, value) to show.
611611
612612
"""
613-
slugs = {"COV", "PY"}
614-
include = {"HOME", "TEMP", "TMP"}
615-
cloak = {"API", "TOKEN", "KEY", "SECRET", "PASS", "SIGNATURE"}
616-
truncate = {"COVERAGE_PROCESS_CONFIG"}
617-
truncate_len = 60
613+
SLUGS = {"COV", "PY"}
614+
INCLUDE = {"HOME", "TEMP", "TMP"}
615+
CLOAK = {"API", "TOKEN", "KEY", "SECRET", "PASS", "SIGNATURE"}
616+
TRUNCATE = {"COVERAGE_PROCESS_CONFIG"}
617+
TRUNCATE_LEN = 60
618618

619619
to_show = []
620620
for name, val in env.items():
621-
keep = False
622-
if name in include:
623-
keep = True
624-
elif any(slug in name for slug in slugs):
625-
keep = True
626-
if keep:
627-
if any(slug in name for slug in cloak):
621+
show = False
622+
if name in INCLUDE:
623+
show = True
624+
elif any(slug in name for slug in SLUGS):
625+
show = True
626+
if show:
627+
if any(slug in name for slug in CLOAK):
628628
val = re.sub(r"\w", "*", val)
629-
if name in truncate:
630-
if len(val) > truncate_len:
631-
val = val[:truncate_len-3] + "..."
629+
if name in TRUNCATE:
630+
if len(val) > TRUNCATE_LEN:
631+
val = val[:TRUNCATE_LEN-3] + "..."
632632
to_show.append((name, val))
633633
return human_sorted_items(to_show)

0 commit comments

Comments
 (0)