moodymudskipper / flow

View and Browse Code Using Flow Diagrams
https://moodymudskipper.github.io/flow/
Other
395 stars 26 forks source link

Better and more drawable code #55

Closed moodymudskipper closed 3 years ago

moodymudskipper commented 3 years ago

With the successive refactoring and some rushed features the code is not very readable nor well structure.

Examining the code with flow_view makes it obvious, and I believe a usecase of flow is to highlight sloppy code, so leading by example it would be nice to have the code well organized, with prefixed comments.

A nice output would be to have the logic of the full package drawn with as litte code as possible (using code = FALSE or code= NA. The package is quite complex so if it can be made easy to understand thanks to flow_doc it'd be a nice showcase.

moodymudskipper commented 3 years ago

We're halfway there, should be possible for almost all functions.

DataStrategist commented 3 years ago

Hi, nice package... could be really useful for documentation purposes also! I love the ## to denote title... since I anyway use ## to distinguish between code that's commented out and a true comment it just plug-and-play with my code!

I will say that due to some sql calls, and some really long comments, sometimes the boxes get really long and the flowchart loses some power. Would it be possible to add an optional parameter truncate default FALSE that if overridden to TRUE (or some value x) it'll truncate the boxes to x characters? that way I choose how much I want to allow the shape to get stupid.

Some other general comments:

Thanks!

moodymudskipper commented 3 years ago

Hi and thanks, it is a good idea (the truncate arg) , I'll look into it.

I think I can implement multiple comment prefixes quite easily too, we would just provide a vector instead of a string, but would you mind sharing the use case?

I would love interactive mode, I just don't know a technology I could rely on to do that, I would check what you suggested.

DataStrategist commented 3 years ago

Hi! Cool, glad the feedback is useful.

In terms of me, ## are comments like "This is where I do thing X". But I use Ctrl+Shift+R to make sections in my code, like Upload, Verify etc...

Using a very loose translation to HTML, for me the #-- comments are H1, the ## are H2. So both are relevant, but differently so.

For the interactive thing, this might be a good place to look: https://datastorm-open.github.io/visNetwork/layout.html in that page they specify how you can assign levels to nodes. Lemme know if you have any questions. But this interactive chart has the benefit of also providing mouse-over information... so perhaps the skeleton could be code=F to keep it minimal, but if someone moused over the node it would provide the code. Could be cool!

moodymudskipper commented 3 years ago

done locally.

Main parts of the code are well commented and suggestions above regarding supporting a vector of prefixes and a truncate argument have been implemented.

github-actions[bot] commented 2 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.