Skip to content

Commit

Permalink
Fix the description of the Loc printer, and adjust the maximal width.
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkaMaul committed Apr 15, 2024
1 parent e11d4f2 commit 08d9817
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions slither/printers/summary/loc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

class LocPrinter(AbstractPrinter):
ARGUMENT = "loc"
HELP = """Count the total number lines of code (LOC), source lines of code (SLOC), \
and comment lines of code (CLOC) found in source files (SRC), dependencies (DEP), \
HELP = """Count the total number lines of code (LOC), source lines of code (SLOC),
and comment lines of code (CLOC) found in source files (SRC), dependencies (DEP),
and test files (TEST)."""

WIKI = "https://github.com/trailofbits/slither/wiki/Printer-documentation#loc"
Expand Down
4 changes: 3 additions & 1 deletion slither/utils/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,10 @@ def output_printers(printer_classes: List[Type[AbstractPrinter]]) -> None:
printers_list = sorted(printers_list, key=lambda element: (element[0]))
idx = 1
for (argument, help_info) in printers_list:
table.add_row([str(idx), argument, help_info])
# Clean multi line HELP info
table.add_row([str(idx), argument, " ".join(x.strip() for x in help_info.splitlines())])
idx = idx + 1

print(table)


Expand Down
3 changes: 2 additions & 1 deletion slither/utils/myprettytable.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def __init__(
# In this case, we fall back to the default behavior (i.e. printing as much as possible)
terminal_column = get_terminal_size((0, 0)).columns
if terminal_column != 0:
self.max_width = terminal_column - 2
# We reduce slightly the max-width to take into account inconsistencies in terminals
self.max_width = terminal_column - 3
else:
self.max_width = max_width

Expand Down

0 comments on commit 08d9817

Please sign in to comment.