Skip to content
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

Pub should parse Dart code to do more validation before uploading #343

Closed
DartBot opened this issue Jun 5, 2015 · 14 comments
Closed

Pub should parse Dart code to do more validation before uploading #343

DartBot opened this issue Jun 5, 2015 · 14 comments
Labels
type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/188?v=3" align="left" width="96" height="96"hspace="10"> Issue by nex3
Originally opened as dart-lang/sdk#7198


Pub should do various sorts of validation that requires Dart code to be parsed. In particular:

Errors:

* Part files in "lib" outside of "lib/src".

  • Non-"package:" imports in "bin".
  • Examples importing from "lib/src".
  • Dart code with relative imports to files that don't exist.
  • Dart code with "package:" imports to files in this package that don't exist.
  • Dart code with "package:" imports for packages that aren't in the pubspec.

Warnings:

* Dart files in "bin" without main() methods.

  • Non-"package:" imports in "test" or "example".
  • Imports in "test" or "example" that reach outside the package.
@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent


Added this to the Later milestone.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/46275?v=3" align="left" width="48" height="48"hspace="10"> Comment by munificent


Removed Type-Defect label.
Added Type-Enhancement label.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/2156198?v=3" align="left" width="48" height="48"hspace="10"> Comment by kasperl


Removed this from the Later milestone.
Added Oldschool-Milestone-Later label.

@DartBot
Copy link
Author

DartBot commented Jun 5, 2015

<img src="https://avatars.githubusercontent.com/u/2156198?v=3" align="left" width="48" height="48"hspace="10"> Comment by kasperl


Removed Oldschool-Milestone-Later label.

@matanlurey
Copy link
Contributor

I'd be happy to contribute code for bad transitive imports.

@nex3
Copy link
Member

nex3 commented Dec 1, 2016

That would be awesome!

@matanlurey matanlurey self-assigned this Dec 2, 2016
@zoechi
Copy link

zoechi commented Dec 2, 2016

@matanlurey Can the linter be used for that to avoid duplicate work? dart-lang/linter#29

@matanlurey
Copy link
Contributor

matanlurey commented Dec 2, 2016

Sure that's possible.

@nex3
Copy link
Member

nex3 commented Dec 2, 2016

Whether or not this logic is in the linter, I'd still love to have it in the pub client. Not everyone lints, but everyone should know if they're going to be uploading something busted.

@matanlurey
Copy link
Contributor

matanlurey commented Dec 2, 2016 via email

@nex3
Copy link
Member

nex3 commented Dec 2, 2016

I suppose you could shove the logic in a package, but I'm not sure the pub validation API and the linter API are similar enough to buy you much from doing that.

@natebosch
Copy link
Member

I file #1981 for using Future from dart:core which we have talked about recently.

@jakemac53 @matanlurey - are there any remaining validations that we feel should live in pub rather than the analyzer? Should we close this?

@matanlurey
Copy link
Contributor

Ideally there would be a way to run certain lints via pub, so users can see these same errors as they develop, not just before they publish. That being said, probably not trackable here.

@natebosch
Copy link
Member

I'm going to close this since I think it's no longer actionable. We'll continue to add individual issues for publish validation as we find them, with a specific focus on things in the pubspec.

sigurdm pushed a commit to sigurdm/pub that referenced this issue Nov 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

5 participants