Skip to content
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 Pyreverse option to exclude standalone nodes #8520

Merged
merged 5 commits into from
Apr 2, 2023

Conversation

nickdrozd
Copy link
Collaborator

Type of Changes

Type
✨ New feature

Description

Closes #8476

@nickdrozd
Copy link
Collaborator Author

From manual test, this seems to work fine. I have no idea how the Pyreverse tests work.

@DudeNr33
Copy link
Collaborator

From manual test, this seems to work fine. I have no idea how the Pyreverse tests work.

For class diagrams you can use the functional tests similar to how the regular test_functional.py works for messages:

  • choose or create a directory under tests/pyreverse/functional/class_diagrams
  • Create a Python file with sample code, e. g. no_standalone.py
  • In your case which requires special command line options: create a no_standalone.rc, and add command_line_args=<your args>
  • Create a corresponding expected output file (default format is MermaidJS) with the same name, i.e. no_standalone.mmd

Unfortunately we don't have a similar concept yet for package diagrams. You can take a look at test_writer.py, which creates class and package diagrams from the files located under tests/data, and add a suitable fixture for a config including the new option there. As far as I see there should already be suitable classes and "packages" (modules also count as packages here) present that should be omitted with --no-standalone.

@github-actions

This comment has been minimized.

@codecov
Copy link

codecov bot commented Mar 31, 2023

Codecov Report

Merging #8520 (80299c1) into main (e9894d3) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #8520   +/-   ##
=======================================
  Coverage   95.90%   95.90%           
=======================================
  Files         174      174           
  Lines       18357    18362    +5     
=======================================
+ Hits        17605    17610    +5     
  Misses        752      752           
Impacted Files Coverage Δ
pylint/pyreverse/main.py 93.87% <ø> (ø)
pylint/pyreverse/writer.py 100.00% <100.00%> (ø)
pylint/testutils/pyreverse.py 98.21% <100.00%> (+0.03%) ⬆️

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@nickdrozd
Copy link
Collaborator Author

@DudeNr33 I keep getting a FileNotFoundError in the package test. Any ideas? There must be some obvious mistake somewhere.

no_standalone_dot_config: PyreverseConfig, get_project: GetProjectCallable
) -> Iterator[None]:
writer = DiagramWriter(no_standalone_dot_config)
project = get_project(TEST_DATA_DIR)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to specify name here like above in setup_colorized_dot. Also you have to rename the files from no_standalone_classes.dot to classes_no_standalone.dot (same for package diagram).

@Pierre-Sassoulas Pierre-Sassoulas added pyreverse Related to pyreverse component Enhancement ✨ Improvement to a component labels Apr 1, 2023
@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 3.0.0, 3.0.0b1 Apr 1, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Apr 1, 2023

🤖 According to the primer, this change has no effect on the checked open source code. 🤖🎉

This comment was generated for commit 80299c1

Copy link
Collaborator

@DudeNr33 DudeNr33 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you for the addition! 👍

@DudeNr33 DudeNr33 merged commit 3b42318 into pylint-dev:main Apr 2, 2023
@Pierre-Sassoulas Pierre-Sassoulas modified the milestones: 3.0.0b1, 3.0.0a7 May 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component pyreverse Related to pyreverse component
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pyreverse: Add option to ignore classes without relationships
3 participants