Mayil-AI-Sandbox / pylint-on-April2022

GNU General Public License v2.0
0 stars 0 forks source link

DOC: pyreverse supported format not recognized missing puml, plantuml, mmd, etc #3

Open vikramsubramanian opened 4 months ago

vikramsubramanian commented 4 months ago

Bug description Some supported formats are not listed in the error messaging:

pyreverse -ASmy -o .puml my_package/my_module.py 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 Here, I have made the mistake of prepending a . to puml. The error output should list puml (and plantuml and mmd and vcg) as supported formats.

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 argument

Pylint version

pylint --version pylint 2.12.2 astroid 2.9.3 Python 3.8.12 | packaged by conda-forge | (default, Oct 12 2021, 21:59:51) [GCC 9.4.0] OS / Environment OpenSUSE Tumbleweed

mayil-ai[bot] commented 4 months ago

To address the issue with the pyreverse utility not listing all supported output formats in the error message, follow these steps:

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)

Here are some code snippets that may help you get started:

💡 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