Skip to content

Conversation

@Jasguerrero
Copy link
Contributor

@Jasguerrero Jasguerrero commented Apr 18, 2022

#2885

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

@flutter-dashboard flutter-dashboard bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Apr 18, 2022
@Jasguerrero Jasguerrero marked this pull request as ready for review April 19, 2022 16:32
Copy link
Contributor

Choose a reason for hiding this comment

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

nit. .toString() is unneeded, the default behavior of interpolating a non-string into a string is to call .toString() on it anyway

Suggested change
buffer.write('$icon ${result.toString()}');
buffer.write('$icon $result');

Copy link
Contributor

Choose a reason for hiding this comment

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

why is this needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need. will delete it next commit

Copy link
Contributor

Choose a reason for hiding this comment

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

nit. prefer final and you can replace the if/else with a ternary

Copy link
Contributor

Choose a reason for hiding this comment

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

this can be final

Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't you be printing the buffer outside of the for loop?

If this is a bug, can you write a test that would have caught it (for example, hard-code the expected logger output, so that we can see what it should look like)? Add it to packages/flutter_tools/test/commands.shard/hermetic/analyze_project_test.dart

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. It should be outside, adding a test is a good idea

Copy link
Contributor

Choose a reason for hiding this comment

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

might as well make this public and get rid of the getter.

Copy link
Contributor

Choose a reason for hiding this comment

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

nit. prefer named parameters when you have more than 2

Copy link
Contributor

Choose a reason for hiding this comment

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

also, this constructor can be made const

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// add validators
// TODO(jsguerrero): add validators

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add dartdoc's for all the new classes you add, and any non-obvious methods? (for example .supportsProject is self-explanatory)

Copy link
Contributor

@christopherfujino christopherfujino Apr 20, 2022

Choose a reason for hiding this comment

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

nit. make this a static on the ProjectValidator class. Static's are essentially global like this; however, it's a little more organized.

Copy link
Contributor

Choose a reason for hiding this comment

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

nit use named parameters when you have more than 2

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

if you call buffer.writeln() here you don't need to print an extra newline in the above scope (line 53).

Suggested change
buffer.write('$icon $result');
buffer.writeln('$icon $result');

Copy link
Contributor

@christopherfujino christopherfujino Apr 20, 2022

Choose a reason for hiding this comment

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

if you are returning early, you can un-nest the conditionals to make reading this easier:

    if (_status == StatusProjectValidator.error) {
      return 'Error: $value';
    }
    if (warning != null) {
      return '$name: $value (warning: $warning)';
    }
    return '$name: $value';

Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to await one before starting the next, or are these safe to run concurrently?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

@christopherfujino christopherfujino Apr 20, 2022

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

i think you can mark this as final

Suggested change
String icon;
final String icon;

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

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

This is coming along great. Just a few nits.

Copy link
Contributor

Choose a reason for hiding this comment

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

Don't re-use the same filesystem between tests

Suggested change
setUpAll(() {
setUp(() {

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm thinking you probably shouldn't re-use the logger between tests?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get rid of this extra line?

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
static List <ProjectValidator> allProjectValidators = <ProjectValidator>[
static const List <ProjectValidator> allProjectValidators = <ProjectValidator>[

terminal: globals.terminal,
artifacts: globals.artifacts,
),
ValidateProjectCommand(
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should add this until it's ready to be used.

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

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

LGTM!

@fluttergithubbot
Copy link
Contributor

This pull request is not suitable for automatic merging in its current state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants