Skip to content

Add automatic SDK warning comparison between versions to dartdoc #1572

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

Merged
merged 20 commits into from
Dec 20, 2017

Conversation

jcollins-g
Copy link
Contributor

Add a new grind target, compare-sdk-warnings, that will take the version of dartdoc in the CWD and compare it running against the same SDK to another version specified by git branch or tag in the environment variable DARTDOC_ORIGINAL. Moves _SubprocessLauncher out into io_utils and adds json parsing support to it for the warning comparison.

@googlebot googlebot added the cla: yes Google CLA check succeeded. label Dec 14, 2017
}

/// Output formatter for comparing warnings.
String printWarningDelta(String title, String dartdocOriginalBranch,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this public for testing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's "public" so it can be imported by grinder. It's not public in another sense, that being it is under lib/src.

Map<String, int> original, Map<String, int> current) {
StringBuffer printBuffer = new StringBuffer();
Set<String> quantityChangedOuts = new Set();
Set<String> onlyOriginal = new Set();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can calculate these using Set.difference()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could, but I would have to build more sets and then throw them away to do so. Map.keys is an iterable, not a set. Since I have to traverse by hand once anyway since "quantityChangedOuts" isn't something computable by difference, it seemed reasonable to do so for all three and save the throwaway Sets.

/// Version of dartdoc we should use when making comparisons.
String get dartdocOriginalBranch {
String branch = 'master';
if (Platform.environment.containsKey('DARTDOC_ORIGINAL')) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warn (or log?) when pulling from an env variable, so people remember they've set it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@jcollins-g jcollins-g merged commit 5e9e1df into master Dec 20, 2017
@kevmoo kevmoo deleted the method-memoizer+sdk_warnings_compare branch January 11, 2018 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google CLA check succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants