Skip to content

Conversation

@Jasguerrero
Copy link
Contributor

@Jasguerrero Jasguerrero commented Jun 30, 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 Jun 30, 2022
group('PubDependenciesProjectValidator', () {

setUp(() {
fileSystem = globals.localFileSystem;
Copy link
Contributor

Choose a reason for hiding this comment

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

does this need to use the real file system? and if so, this should probably be in the integration shard.

Copy link
Contributor Author

@Jasguerrero Jasguerrero Jun 30, 2022

Choose a reason for hiding this comment

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

Not really. I can use a FakeFileSystem here

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

fileSystem = globals.localFileSystem;
});

testWithoutContext('success ', () async {
Copy link
Contributor

Choose a reason for hiding this comment

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

out of curiosity, why the trailing space in the test name?

Copy link
Contributor Author

@Jasguerrero Jasguerrero Jun 30, 2022

Choose a reason for hiding this comment

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

That was a typo

Copy link
Contributor

Choose a reason for hiding this comment

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

👍

fileSystem = globals.localFileSystem;
});

testWithoutContext('success ', () async {
Copy link
Contributor

Choose a reason for hiding this comment

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

also, maybe name this 'success when all dependencies are hosted'

final ProcessManager processManager = FakeProcessManager.list(<FakeCommand>[
const FakeCommand(
command: <String>['dart', 'pub', 'deps', '--json'],
stdout: 'stdout command fail',
Copy link
Contributor

Choose a reason for hiding this comment

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

what does this mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just expecting something not a json (eg: if you haven't updated your pub dependencies and the pubspec has changed pub dart deps returns a message to update them. I don't have the exact message so I just fake this)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also if for some reason dart pub deps --json breaks we will catch that and pass the stacktrace to the validator output

Copy link
Contributor

Choose a reason for hiding this comment

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

Good thinking. However, if the command breaks any debug messaging should go to STDERR, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

I could be wrong, but I would imagine if you pass --json, only valid JSON should be output to stdout, and any diagnostics would go to stderr.

final List<ProjectValidatorResult> result = await validator.start(
FlutterProject.fromDirectoryTest(fileSystem.currentDirectory)
);
const String expected = 'All dependencies are hosted';
Copy link
Contributor

Choose a reason for hiding this comment

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

will the user have enough context to understand what this means?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The user will read [✓] Dart dependencies: All dependencies are hosted

Copy link
Contributor

Choose a reason for hiding this comment

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

will they know what that means?

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 don't know. Should I add something like [✓] Dart dependencies: All dart dependencies comes from known places or something along those lines?

Copy link
Contributor

Choose a reason for hiding this comment

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

will they know what "comes from" means?

I guess backing up, what is the high level information that you want to communicate to the user?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If one ore more dependencies do not come from pub.dev eg: they are pointing to a github repo to get it #103614

final List<ProjectValidatorResult> result = await validator.start(
FlutterProject.fromDirectoryTest(fileSystem.currentDirectory)
);
const String expected = 'dep1, dep2 are not hosted';
Copy link
Contributor

Choose a reason for hiding this comment

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

same question, will the user have enough context to understand what this means? in other words, are we going to get bug reports that they're getting warnings on their project when everything works?


final DartPubJson dartPubJson = DartPubJson(jsonResult);
final List <String> dependencies = <String>[];
final Set<String> hostedDependencies = {'hosted', 'root'};
Copy link
Contributor

Choose a reason for hiding this comment

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

what does 'root' mean? please add a comment explaining both hosted and root.

}

class PubDependenciesProjectValidator extends ProjectValidator {
PubDependenciesProjectValidator(this._processManager);
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
PubDependenciesProjectValidator(this._processManager);
const PubDependenciesProjectValidator(this._processManager);

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 couldn't implement this because of the abstract class

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 make the super also const?

Copy link
Contributor

Choose a reason for hiding this comment

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

you'll have to make title final, but i don't think that should be a problem

@@ -0,0 +1,62 @@
import 'dart:collection';

class Package {
Copy link
Contributor

Choose a reason for hiding this comment

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

this definitely needs a dartdoc, and maybe a more specific name. Note that since the convention in Dart is to just do import 'foo.dart';, every name gets imported into that library's namespace

if (items.isEmpty || items.length > 1) {
throwToolExit('The suggestions flags needs one directory path');
if (items.isEmpty) { // user did not specify any path
_logger.printStatus('Showing suggestions for current directory');
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
_logger.printStatus('Showing suggestions for current directory');
_logger.printTrace('Showing suggestions for current directory: ${_fileSystem.currentDirectory.path}');

final List<String> dependencies;

static Package fromHashMap(dynamic packageInfo) {
static DartDependencyPackage fromHashMap(dynamic packageInfo) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Dart style nit:

Suggested change
static DartDependencyPackage fromHashMap(dynamic packageInfo) {
factory DartDependencyPackage.fromHashMap(dynamic packageInfo) {

Copy link
Contributor

Choose a reason for hiding this comment

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

this is a style nit, this could very well compile to the same machine code

const String expected = '\n'
'┌────────────────────────────────────────────────────────────────────────────────────┐\n'
'│ Pub dependencies │\n'
'│ [✓] Dart dependencies: All pub dependencies are hosted in https://pub.dartlang.org │\n'
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
'│ [✓] Dart dependencies: All pub dependencies are hosted in https://pub.dartlang.org │\n'
'│ [✓] Dart dependencies: All pub dependencies are hosted on https://pub.dartlang.org │\n'

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

@christopherfujino
Copy link
Contributor

nit: let's just make these all green, success, since it's not really a problem. Follow-up will be in #107675

@Jasguerrero Jasguerrero added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 15, 2022
@auto-submit auto-submit bot merged commit cdf5b1d into flutter:master Jul 15, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 21, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 22, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 23, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 23, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 24, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 24, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 25, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 26, 2022
camsim99 pushed a commit to camsim99/flutter that referenced this pull request Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants