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

Better detection or prevention of invalid output #60

Open
Justin-W opened this issue Oct 24, 2019 · 0 comments
Open

Better detection or prevention of invalid output #60

Justin-W opened this issue Oct 24, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@Justin-W
Copy link

There have been a few issues in the past (e.g. #3, #50, #49) where the plantuml output contained invalid syntax/content. It might be a good idea to add some output filtering and/or monitoring to automatically detect and/or filter and/or comment out portions of the output that will prevent plantuml from rendering the rest of the output.

For example, from #50 (by @jfeliu007):

This is definitely a bug. {{packageName}} is use to to have a placeholder to later substitute the package name by the real name since many go file prefer to name imports using aliases.

Issues like those described in #49, #50 and #3 could be prevented from causing un-renderable output by filtering out (or commenting out) any lines that contain occurrences of certain known patterns.

For example:

goplantuml -recursive . | grep -v '{packageName}' | grep -F -v '<font color=blue>func</font>()' > goplantuml.recursive.puml

Such lines could alternatively be commented-out (instead of stripped) (e.g. using sed).

Either of the above workarounds could be done manually by the user (using grep and/or sed or similar), except a novice user is unlikely to know what patterns to strip/convert. And (as issue #32 demonstrates) some users don't know enough about plantuml to effectively identify and manually correct such errors in the output.

Instead, goplantuml could internally perform equivalent filtering/commenting, so that users don't have to.

Also, it would be a better user experience if goplantuml automatically prevented a handful of errors from making the entire output un-renderable. E.g. For the first project I used goplantuml on, it generated >5000 lines of output that contained only 2 invalid lines. Simply removing or commenting-out those 2 lines made the rest of the diagram renderable and useful (though slightly incomplete due to the 2 missing edges/arrows).

Also, additional functional tests could be added to this repo (targeting a wider variety of OSS golang packages) and use similar pattern detection to detect whether goplantuml generates any such invalid output is generated. Such tests would likely detect functional regressions in goplantuml (e.g. when new versions of golang are released).

@jfeliu007 jfeliu007 added the enhancement New feature or request label Oct 26, 2019
@jfeliu007 jfeliu007 added this to To do in Release 1.4.0 Oct 28, 2019
@jfeliu007 jfeliu007 removed this from To do in Release 1.4.0 Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants