Thoughts regarding Detecting Semantic Version Violations

121 views
Skip to first unread message

Ramyak Mehra

unread,
Mar 28, 2022, 5:55:03 PM3/28/22
to dart-gsoc

Hello, ramyak this side. I am planning to contribute to the Semantic Version project.

I have past experience with using the dart: analyzer package.

I had some thoughts regarding the project-

1. Do we have to evaluate the native android and ios code as well or just the dart code.

2. We generate the JSON blob for the whole project, but the error/warnings reporting should be done on the user-facing API only or the whole project.

3. For a class or a file we could hash the JSON object and compare the hashes and only traverse further if there is a mismatch. This performance benefit for this needs to evaluate if it is worth it or not.

4. Should it be multi-threaded to increase the performance. I don't see the need for it though just a thought that I had.

Ramyak Mehra

unread,
Apr 2, 2022, 8:53:22 AM4/2/22
to dart-gsoc
I was looking through the analyzer package, and found this function which we can use as a starting point for parsing.

Jonas Jensen

unread,
Apr 4, 2022, 7:13:34 AM4/4/22
to dart-gsoc

> 1. Do we have to evaluate the native android and ios code as well or just the dart code.

No, I would focus exclusively on the Dart code. And only on the exported classes / methods /getters, etc.
Anything internal in the package is irrelevant, that includes anything in lib/src/ unless exported through a file in lib/

> I was looking through the analyzer package, and found this function which we can use as a starting point for parsing.
You probably need to create an AnalysisSession, something like:
    final session = ContextBuilder()
        .createContext(
          contextRoot: ContextLocator().locateRoots(
            includedPaths: [path.normalize(packageDir)],
          ).first,
        )
        .currentSession;

You'll want to get not just the ParsedLibrary, but probably the ResovledLibrary, ie. after type checking..
And then look for things like what has been exported:

That way we can take import/exports into consideration.

> 4. Should it be multi-threaded to increase the performance. I don't see the need for it though just a thought that I had.

Let's not even think about that before we have something that works :D
Also I think this will be limited by the speed of the analyzer, just guessing.

Ramyak Mehra

unread,
Apr 16, 2022, 7:35:40 AM4/16/22
to dart-gsoc
I have shared a sample proposal google doc link. I still have to include the timeline. But feel free to give any suggestions if you have.
Reply all
Reply to author
Forward
0 new messages