Skip to content

Commit

Permalink
🚸 Show actual length (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
robvanderleek authored Sep 3, 2023
1 parent 917dbea commit 35e376a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions codelimit/common/report/Report.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ def summary(self) -> str:
)
high_risk = len([m for m in self.codebase.all_measurements() if m.value > 60])
if high_risk > 0:
return f" Refactoring necessary, unmaintainable functions: {high_risk}"
return f"🚨 Refactoring necessary, unmaintainable functions: {high_risk}"
elif medium_risk > 0:
return (
f"⚠️ Don't forget to refactor, hard-to-maintain functions: "
f"🔔 Don't forget to refactor, hard-to-maintain functions: "
f"{medium_risk}"
)
else:
Expand Down
2 changes: 1 addition & 1 deletion codelimit/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def format_unit(name: str, length: int, file: Union[str, None] = None) -> Text:
else:
color = "green"
result = Text()
result.append(f"{length:3}" if length < 61 else "60+")
result.append(f"{length:3}" if length < 1000 else str(length))
result.append(Text(" | ", style=Style(color=color)))
if file:
result.append(Text(f"{file}:", style=Style(dim=True)))
Expand Down
4 changes: 3 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@
def test_format_unit():
assert format_unit("bar()", 1).markup == " 1[green] | [/green]bar()"
assert format_unit("bar()", 20).markup == " 20[yellow] | [/yellow]bar()"
assert format_unit("bar()", 70).markup == "60+[red] | [/red]bar()"
assert format_unit("bar()", 70).markup == " 70[red] | [/red]bar()"
assert format_unit("bar()", 700).markup == "700[red] | [/red]bar()"
assert format_unit("bar()", 7000).markup == "7000[red] | [/red]bar()"

0 comments on commit 35e376a

Please sign in to comment.