graphVerification external files bug - #194
Closed
jayden-ong wants to merge 9 commits into
Closed
Conversation
…heir specified programming language (js, py, java, ts)
…programming language they selected when first creating project
…nothing is entered
…-architecture-visualizer project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
When we run the frontend for the clean-architecture-visualizer project, there is a bug where external nodes show up as missing, even though they exist. There is also a bug where edges between two external nodes don't show up. There is also a problem with extracting the file context when the "from" node is a use case interactor or entity.
Proposed Changes
To allow all of the external nodes to show up, all of the external files are added to every use case, even if there isn't necessarily a connection between the use case and the file. For example, the useCaseGraph entity is added to the createFeature use case, even though one never invokes the other. This allows the node to show up and to signify that the nodes are not related, there are no arrows between the node and the rest of the nodes in the use case. The reason edges between external nodes don't show up is because the importFileName removes the file extension when the file extension is part of the unique identifier for file names. Without it, graphVerification doesn't detect any connections between two external files. To fix the bug where the edges don't show up, we check if the external file name contains the name of the import, so file extension does not play a factor.
Because there could be multiple files of the same type in a use case (three data access files for example), there could be multiple matching nodes when we look for violation nodes. To find the right one, we filter all candidates and check if they have a defined file context. This means that there is a line that references the "from" node file, signifying a violation.
The problem with extracting file context from a use case interactor and entity is that interactor files normally just contain "interactor" and not "usecaseinteractor" which is what file context is looking for. The same thing happens for "entities" and "entity". To fix this, there is a check in "fileAccess" that if the target is "useCaseInteractor", it will also accept "interactor" and if it is looking for "entity", it will also accept "entities".
...
Screenshots of your changes (if applicable)
Before:How to Test & Review
(Help your reviewer by providing clear instructions on how to verify your changes. Include specific commands, edge cases to watch out for, or UI navigation paths.)
Type of Change
(Write an
Xor a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]into a[x]in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
[x ] I have performed a self-review of my changes.
[x ] I have added tests for my changes, if applicable.
[x ] I have updated the project documentation, if applicable.
(Frontend) I have added/updated text in
i18nJSON files for any new user-facing strings to support multilingual features.After opening your pull request:
[ x] I have verified that the CI tests have passed.
[ x] I have requested a review from a project maintainer, and a fellow student.
Technical Debt: If temporary workarounds or "TODOs" were used, I have opened a tracking issue to address them properly.
Questions and Comments