Skip to content

Conversation

@isoos
Copy link
Collaborator

@isoos isoos commented May 23, 2017

I wanted it to structure it in a way that helps to develop its parts in parallel.

Copy link
Member

@kevmoo kevmoo left a comment

Choose a reason for hiding this comment

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

Good start!

Copy link
Member

Choose a reason for hiding this comment

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

make final

Copy link
Member

Choose a reason for hiding this comment

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

make final

Copy link
Member

Choose a reason for hiding this comment

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

I have all of this written already - https://github.com/kevmoo/pana.dart

Mostly. Need to expose some of the private impl stuff I have

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

looks good! Any ETA for publishing the recent changes?

Copy link
Member

Choose a reason for hiding this comment

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

Just did...

Copy link
Member

Choose a reason for hiding this comment

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

@kevmoo No you did not! The last upload to package:pana was in 2015!

Copy link
Member

Choose a reason for hiding this comment

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

Also if we want to use package:pana for the task, why this code here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This code precedes my awareness of pana. I think pana is a better place for most of this analysis, and I'm planning to contribute to it (e.g. dart-lang/pana#3). At the same time as soon as it is 'good enough', I'll update this PR with the 'pana' version.

@kevmoo
Copy link
Member

kevmoo commented May 24, 2017

@mkustermann would you take a look and merge?

}

class PubspecLock {
Map _content;
Copy link
Member

Choose a reason for hiding this comment

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

Since you initialize it in the constructor, you might as well make it final (and use initializer rather than constructor body)

'with exit code: ${result.exitCode}\n'
'stdout: ${result.stdout}\n'
'stderr: ${result.stderr}');
throw new Exception('Failed to extract tarball.');
Copy link
Member

Choose a reason for hiding this comment

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

Consider changing readTarballFile to also log a warning - for consistency.

}

List<LockedDependency> get packages {
if (_packages == null) {
Copy link
Member

Choose a reason for hiding this comment

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

Why do this lazily? The only reason one would construct a PubspecLock object is to call packages on it.

// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

library pub_dartlang_org.analysis;
Copy link
Member

Choose a reason for hiding this comment

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

Maybe use a consistent name for the filename and library name (i.e. analysis -> analyzer).

? new Directory(workDir)
: Directory.systemTemp.createTempSync();
return new Analyzer._(new File(source), wd, workDir == null);
}
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it would be easier to read when using only one instead of two constructors:

Analyzer(String source, {String workdir}) 
    : _sourceTarGz = new File(source),
      _workDir  = workdir != null ? new Directory(workdir) : Directory.systemTemp.createTempSync(),
      _clearWorkDir = workdir == null;

}

/// Prepares the directories for the analysis and extracts the package.
Future setUp() async {
Copy link
Member

Choose a reason for hiding this comment

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

Consider renaming it from setUp to extractTarball.

Copy link
Member

Choose a reason for hiding this comment

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

@kevmoo No you did not! The last upload to package:pana was in 2015!

Copy link
Member

Choose a reason for hiding this comment

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

Also if we want to use package:pana for the task, why this code here?

/// Reads pubspec.yaml and pubspec.lock.
Future readPubspecs() async {
final String pubspecContent = await new File(
_packageDir.path + Platform.pathSeparator + 'pubspec.yaml')
Copy link
Member

Choose a reason for hiding this comment

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

Consider using package:path/path.dart and do path.join(_packagesDir.path, 'pubspec.yaml')

@isoos
Copy link
Collaborator Author

isoos commented May 30, 2017

I believe that the recent changes and the two open PRs at https://github.com/kevmoo/pana.dart cover more than I was planning here. As soon as there is a new version, I'll close this PR and create a new one using pana.

@isoos
Copy link
Collaborator Author

isoos commented Jun 6, 2017

pana handles all of these now, closing PR.

@isoos isoos closed this Jun 6, 2017
@isoos isoos deleted the processing_proto branch July 14, 2017 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants