-
Notifications
You must be signed in to change notification settings - Fork 945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a new parameter max_width
to MyPrettyTable
#2426
base: dev
Are you sure you want to change the base?
Conversation
…ay for CLI usage This PR adds a `max_width` parameter to MyPrettyTable to restrict the maximum width of its underlying table. The value can be an integer, "max" (detect automatically the correct width) or None (no width limit)
WalkthroughWalkthroughThe changes involve updating the version requirement for the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CommandLine
participant MyPrettyTable
participant Terminal
User->>CommandLine: Run a command
CommandLine->>MyPrettyTable: Initialize table with max_width="max"
MyPrettyTable->>Terminal: Get terminal size
Terminal-->>MyPrettyTable: Return terminal dimensions
MyPrettyTable->>CommandLine: Return formatted table
CommandLine-->>User: Display formatted table
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
I would keep this onhold until prettytable is upgraded upstream. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Outside diff range and nitpick comments (3)
setup.py (1)
Line range hint
3-3
: Remove unnecessary open mode parameters.- with open("README.md", "r", encoding="utf-8") as f: + with open("README.md", encoding="utf-8") as f:slither/utils/command_line.py (2)
Line range hint
126-126
: Convert tonot in
for membership tests to improve readability.- if not filter_wiki in detector.WIKI: + if filter_wiki not in detector.WIKI:Also applies to: 240-240
Line range hint
157-157
: Consider renaming the variablel
to something more descriptive to avoid ambiguity.- for l in lines: + for line in lines:Also applies to: 171-171
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (4)
- setup.py (1 hunks)
- slither/printers/summary/loc.py (1 hunks)
- slither/utils/command_line.py (2 hunks)
- slither/utils/myprettytable.py (5 hunks)
Files skipped from review due to trivial changes (1)
- slither/printers/summary/loc.py
Additional context used
Ruff
setup.py
3-3: Unnecessary open mode parameters (UP015)
Remove open mode parameters
slither/utils/command_line.py
126-126: Test for membership should be
not in
(E713)Convert to
not in
157-157: Ambiguous variable name:
l
(E741)
171-171: Ambiguous variable name:
l
(E741)
240-240: Test for membership should be
not in
(E713)Convert to
not in
Additional comments not posted (3)
setup.py (1)
16-16
: Update toprettytable
version requirement is aligned with the PR's objectives.slither/utils/myprettytable.py (1)
Line range hint
11-37
: The implementation of themax_width
parameter inMyPrettyTable
is well-handled, including terminal size detection.slither/utils/command_line.py (1)
275-277
: The use of themax_width="max"
parameter in output functions aligns with the PR's objectives to improve table formatting.Also applies to: 359-359
Add a new parameter
max_width
to MyPrettyTable to enhance its display for CLI usageThis PR adds a
max_width
parameter to MyPrettyTable to restrict the maximum width of its underlying table.The value can be an integer, "max" (detect automatically the correct width) or None (no width limit)
The output is better, and will be even better once
prettytable
will be upgraded to 3.10.1 on PyPihttps://github.com/jazzband/prettytable/releases/tag/3.10.1
Summary by CodeRabbit
New Features
Bug Fixes
Chores
prettytable
package version requirement to>=3.10.0
.