Open vikramsubramanian opened 4 months ago
To address the issue with the pyreverse
utility not listing all supported output formats in the error message, follow these steps:
Update the check_if_graphviz_supports_format
function in pylint/pyreverse/utils.py
to include the additional formats that pyreverse
supports but are not directly supported by Graphviz.
Here is the updated code snippet for the check_if_graphviz_supports_format
function:
def check_if_graphviz_supports_format(output_format: str) -> None:
# ... existing code ...
# Add custom formats supported by pyreverse
custom_formats = {'puml', 'plantuml', 'mmd', 'vcg'}
supported_formats_set = set(supported_formats.split()) | custom_formats
if output_format not in supported_formats_set:
all_supported_formats = ' '.join(sorted(supported_formats_set))
print(
f"Format {output_format} is not supported. Supported formats are: {all_supported_formats}"
)
sys.exit(32)
This modification adds a set of custom formats (puml
, plantuml
, mmd
, vcg
) to the existing supported formats from Graphviz.
The error message will now correctly list all formats supported by pyreverse
, including both Graphviz-supported formats and pyreverse
-specific formats.
pylint/pyreverse/utils.py:283-308 | This snippet contains the function to be updated for recognizing additional formats as per the RESPONSE.
pylint/pyreverse/main.py:1-247 | Lists directly supported formats, which should be referenced in the error message for unrecognized formats.
💡 To rerun Mayil, comment mayil-ai rerun
. Mayil will incorporate any new context added to the ticket. Include details in your rerun comment to guide Mayil!
Last updated at 30-May-2024 11:10 AM | Attempt 7
Bug description Some supported formats are not listed in the error messaging:
Without the preceding ., the command runs as expected.
Command used
> pyreverse -ASmy -o .puml my_package/my_module.py
Pylint output parsing my_package/my_module.py... Format: "puml" not recognized. Use one of: bmp canon cmap cmapx cmapx_np dot dot_json eps fig gd gd2 gif gtk gv ico imap imap_np ismap jpe jpeg jpg json json0 mp pdf pic plain plain-ext png pov ps ps2 svg svgz tif tiff tk vml vmlz vrml wbmp x11 xdot xdot1.2 xdot1.4 xdot_json xlib Expected behavior All supported formats are listed when user makes a typo in the -o format argumentPylint version