-
Notifications
You must be signed in to change notification settings - Fork 12
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
a surveyor for Widget 2-grams #1
Comments
@jayoung-lee @InMatrix, the current output looks like:
where |
Great! I have one suggestion to make analysis easier: Could you replace ":" with "," so that I can easily export this output to a csv file? Actually, it will be awesome if somehow your code can generate such a csv file as an output! |
Sure! As of e54bad0, it now emits a list of entries like this:
Is that good?
That's easy too. Let's talk about what we want ultimately... One file per project? Or one file for all of them? If it's one file for all of them do we just want total counts? |
From my perspective, the easiest approach is a single csv file for each analysis (e.g, widget usage, widget 2-gram usage, package usage, etc.) with distinct and consistent patterns in the filename. I’ll just describe what I anticipate below (based on our conversation so far)! Let’s say there is a submission titled “flutter_create” and we are interested in widget usage, 2-gram widgets, and package usage. Then I’d expect three files,
Then the csv file that contains 2-gram analysis results may be titled
Similarly, for the general widget usage analysis (i.e., counting the number of widget appearance in the code), I’d expect something like
And for packages, In addition to these files, If we have some interesting submission-level stats, we can also have a single summary file for all of the submissions (
Taken all together, the widget_surveyor may generate a set of files:
Does this make sense to you? Am I missing anything? I’m open to any suggestions! :) |
Sounds good! So far I've got support for 2 grams. Running
I'll take a look at widget counts and summaries in a bit. In the meantime, @jayoung-lee: does this look about right? |
Looks perfect! |
Widget counts are being collected now:
@jayoung-lee: as a next step I think we should do some validation. Perhaps we could select a project or two, do a manual count and verify that the results are as expected? |
Sounds like a good idea! If you could pick a couple of examples (ones that you've already run the surveyor on?), I will take a look at them. |
As a quick sanity check, you could look at the two projects checked into surveyor/test/data/basic_app/lib/main.dart Lines 37 to 65 in a8f68cb
and surveyor/test/data/animated_container/lib/main.dart Lines 21 to 71 in a8f68cb
Their 2-grams and counts are inlined in the comments above (#1 (comment) and #1 (comment) respectively.) |
Wow, nice progress! Some minor feedback on the notation:
Would it be more intuitive to have -> signify "parent of", since the parent is on the left (and upper) side of the child in the code? I was initially puzzled by |
Totally up to you! I think my point of reference was inheritance diagrams where Another thought is to be less suggestive and just use a delimiter like Whatever makes the most sense to you all works for me and it's an easy change! |
I took a look at the So I guess the And for the widget counts, why was And I'd like +1 to @InMatrix 's suggestion, just because it is easier for humans to read (or me!). I find it much easier to read things top-down and left-to-right :) For example,
|
Ok, so that was obviously not right! Thanks for taking a look (though I should probably have noticed 😬). Here's where we are after some fixes:
At a quick inspection that looks closer to the outline: But please do double-check! |
No worries! The new output looks correct to me too :D |
A jumping off point for iteration is defined in
example/widget_surveyor.dart
surveyor/example/widget_surveyor.dart
Lines 13 to 18 in 96cd750
More details/instructions in the
README
.Feedback welcome!
/cc @jayoung-lee @InMatrix
The text was updated successfully, but these errors were encountered: