Skip to content

Pyreverse produces a class diagram even when there are no classes in the source code #9237

Open
@ghazpar

Description

@ghazpar

Bug description

Pyreverse produces a class diagram file even when there are no classes in the source code. Moreover, the mermaid output reports a syntax error for this output, because the generated HTML contains an empty classDiagram tag.

Configuration

No response

Command used

Using an empty test.py file in an otherwise empty folder, the following command:

pyreverse -o html test.py

Produces a classes.html with the content below.

Pylint output

<html>
  <body>
    <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
      <div class="mermaid">

        classDiagram

       </div>
  </body>
</html>

Expected behavior

No classes.html file since there are no classes in the source code.

And if a classes.html needs to be produced, I would expect that this file would not generate a mermaid syntax error when viewed in a browser.

Pylint version

pylint 3.0.2
astroid 3.0.1
Python 3.9.10 (v3.9.10:f2f3f53782, Jan 13 2022, 16:55:45)
[Clang 13.0.0 (clang-1300.0.29.30)]

OS / Environment

macOS Ventura (probably not relevant).

Additional dependencies

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions