Giter Site home page Giter Site logo

pana's Introduction

Build Status

A library for analyzing Dart packages. It invokes executables from the Dart SDK (or from the Flutter SDK if the package uses Flutter).

Reports are created in the following categories:

Used by the Dart Package site.

Use as an executable

Installation

dart pub global activate pana

Usage

You can specify either a package (+ version) or a local directory to analyze:

Usage: pana [<options>] --hosted <published package name> [<version>]
       pana [<options>] <local directory>

Options:
      --dart-sdk               The directory of the Dart SDK.
      --flutter-sdk            The directory of the Flutter SDK.
      --exit-code-threshold    The exit code will indicate if (max - granted points) > threshold.
  -j, --json                   Output log records and full report as JSON.
      --hosted-url             The server that hosts <package>.
                               (defaults to "https://pub.dev")
  -l, --line-length            The line length to use with dart format.
      --hosted                 Download and analyze a hosted package (from https://pub.dev).
      --[no-]dartdoc           Run dartdoc and score the package on documentation coverage.
                               (defaults to on)
      --dartdoc-version        The dartdoc version to use: `sdk`, `latest` (default) or `<version constraint>`.

pana's People

Contributors

athomas avatar axel-op avatar bharat-biradar avatar bwilkerson avatar cicadacinema avatar dependabot[bot] avatar devoncarew avatar franklinyow avatar isoos avatar jakobr-google avatar jonasfj avatar kentcb avatar kevmoo avatar mit-mit avatar nilsreichardt avatar parlough avatar pq avatar rexios80 avatar satvik2131 avatar scheglov avatar shilangyu avatar sigurdm avatar sortie avatar srawlins avatar szakarias avatar talisk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pana's Issues

Let's remove LibraryScanner overrides

(1) The override in its current form is misleading, because it creates a dart:web_safe_io package which doesn't exists, but somebody may think it does. A dart-trusted:http would be a more adept name.

(2) I think having these overrides is a bad precedent, for the following reasons:

  • We don't want to keep track all of the libraries that use dart:io in a web-safe way. Getting onto that list, changing it would require efforts on all sides.
  • We may track a few, but forget about it. As the libraries, change, some of these information gets outdated, even in a breaking way, and provides misleading results.
  • Tracking package_resolver's http use is an ever worse precedent: are we going to list everything there that has http as its dependency?

The correct solution: analyze the Dart sources and detect, whether the client is going to use any of the non-web-related dart:io code, and mark it as such. This a lot of effort, and probably not worth it at the moment.

The optimistic solution: let's assume that when both dart:html and dart:io is present, it is importing it in a web-safe-io way. We already have tests for this: https://github.com/dart-lang/pana/blob/master/test/platform_test.dart#L83

I'd go with optimistic solution, and remove the overrides altogether.

Consolidate naming and serialized structure

Some classes and fields are confusing, for example:

  • Summary vs. PubSummary vs. Pubspec
  • AnalyzerOutput (which should be SourceIssue) vs. AnalyzerIssue (which should be ToolIssue).
  • PubspecPlatform vs. PlatformInfo

I think 0.4 should be released with the directory option to unblock pub site's cache issue, and these could go in the next release.

Tracking issues for flutter CLI support

Couple of things we need to decide:

  • How to pick flutter and Android SDK versions for analysis?

    • Do we do that as part of the pana library, or is it assumed to be done externally?
    • Can/should flutter use the Dart SDK we specify, or are we fine with whatever version it downloads?
    • For how long can we reuse the downloaded stack?
  • The third-party dependency involvement here seems to be huge, and we use very little of it. Is there an alternative way to "simulate" flutter's version of pub get, without the full flutter stack?

Document in the README how to run pana

New pub website says "Follow the suggestions on the analysis tab on the package page, or run pana manually to check these before publishing." but I can't see how to run it.

It doesn't add any binaries if I pub global activate it.

Stack overflow w/ angular_ast at 0.4.0-alpha+2

dart --checked bin/main.dart angular_ast 0.4.0-alpha+2
SEVERE     Error scanning direct librariers
           Stack Overflow
           #0      _HashMap.putIfAbsent (dart:collection-patch/dart:collection/collection_patch.dart:130)
           #1      CacheEntry.getResultData (package:analyzer/src/context/cache.dart:423:23)
           #2      CacheEntry._setErrorState (package:analyzer/src/context/cache.dart:800:27)
           #3      CacheEntry._setErrorState.<anonymous closure> (package:analyzer/src/context/cache.dart:813:17)
           #4      _HashFieldBase&_HashBase&_OperatorEqualsAndHashCode&SetMixin.forEach (dart:collection/set.dart:145)
           #5      CacheEntry._setErrorState (package:analyzer/src/context/cache.dart:808:31)
           #6      CacheEntry._setErrorState.<anonymous closure> (package:analyzer/src/context/cache.dart:813:17)
           #7      _HashFieldBase&_HashBase&_OperatorEqualsAndHashCode&SetMixin.forEach (dart:collection/set.dart:145)
           #8      CacheEntry._setErrorState (package:analyzer/src/context/cache.dart:808:31)
           #9      CacheEntry._setErrorState.<anonymous closure> (package:analyzer/src/context/cache.dart:813:17)
           #10     _HashFieldBase&_HashBase&_OperatorEqualsAndHashCode&SetMixin.forEach (dart:collection/set.dart:145)
           ...
           ...
           #13660  _RootZone.runUnary (dart:async/zone.dart:1379)
           #13661  _FutureListener.handleValue (dart:async/future_impl.dart:129)
           #13662  _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:635)
           #13663  _Future._propagateToListeners (dart:async/future_impl.dart:664)
           #13664  _Future._completeWithValue (dart:async/future_impl.dart:477)
           #13665  _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:509)
           #13666  _microtaskLoop (dart:async/schedule_microtask.dart:41)
           #13667  _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
           #13668  _runPendingImmediateCallback (dart:isolate-patch/dart:isolate/isolate_patch.dart:111)
           #13669  _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:164)
INFO       Scanning transitive dependencies...
SEVERE     Error scanning transitive librariers
           Stack Overflow
           #0      _HashMap.putIfAbsent (dart:collection-patch/dart:collection/collection_patch.dart:130)
           #1      CacheEntry._setErrorState (package:analyzer/src/context/cache.dart:423:23)
           #2      CacheEntry._setErrorState.<anonymous closure> (package:analyzer/src/context/cache.dart:813:17)
           #3      CacheEntry._setErrorState (package:analyzer/src/context/cache.dart)
           #4      CacheEntry._setErrorState.<anonymous closure> (package:analyzer/src/context/cache.dart:813:17)
           #5      CacheEntry._setErrorState (package:analyzer/src/context/cache.dart)
           #6      CacheEntry._setErrorState.<anonymous closure> (package:analyzer/src/context/cache.dart:813:17)
           #7      CacheEntry._setErrorState (package:analyzer/src/context/cache.dart)
           #8      CacheEntry._setErrorState.<anonymous closure> (package:analyzer/src/context/cache.dart:813:17)
           #9      CacheEntry._setErrorState (package:analyzer/src/context/cache.dart)
           #10     CacheEntry._setErrorState.<anonymous closure> (package:analyzer/src/context/cache.dart:813:17)
           #11     CacheEntry._setErrorState (package:analyzer/src/context/cache.dart)
           #12     CacheEntry._setErrorState.<anonymous closure> (package:analyzer/src/context/cache.dart:813:17)
           #13     CacheEntry._setErrorState (package:analyzer/src/context/cache.dart)
           ...
           ...
           #9053   _RootZone.runUnary (dart:async/zone.dart:1379)
           #9054   _FutureListener.handleValue (dart:async/future_impl.dart:129)
           #9055   _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:635)
           #9056   _Future._propagateToListeners (dart:async/future_impl.dart:664)
           #9057   _Future._completeWithValue (dart:async/future_impl.dart:477)
           #9058   _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:509)
           #9059   _microtaskLoop (dart:async/schedule_microtask.dart:41)
           #9060   _startMicrotaskLoop (dart:async/schedule_microtask.dart:50)
           #9061   _runPendingImmediateCallback (dart:isolate-patch/dart:isolate/isolate_patch.dart:111)
           #9062   _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:164)
INFO       Analyzing package...

Classify crashes of tools differently

See #138

There should be a Suggestion.bug or similar that tells users to file an issue.

We need to be able to find these types of issues quickly and (hopefully) fix them.

License detection: separate package?

License detection is a neat, easy-to-separate feature which could live in its own package (e.g. license). Contribution to it would be easier, it would be normal there to have all of the different license texts part of the tests, but it won't put much drag on the pana repo. Thoughts?

Add `description` to `Suggestion.bug` ctor

Populate it in the title field instead of the hard-wired. "'There is likely a bug in the analysis code or a dependency.'"

Then populate the details w/ creating LibraryScanner, scanning direct dependencies, etc. We should keep track of this info.

Override analyzer_options.yaml?

Shall we do it? If somebody disables every warning, our report will display it as clean, while in reality it may be full of warnings or errors.

dobx_ds 0.1.0 parse failure

It looks like that parsing of dobx_ds 0.1.0 fails for several reasons. The following log is after the NPE of #55 was fixed.

dart bin/main.dart dobx_ds 0.1.0
INFO       SDK: Dart VM version: 1.24.2 (Thu Jun 22 08:42:17 2017) on "macos_x64"
INFO       Package: dobx_ds
INFO       Version: 0.1.0
FINE       Using .package-cache: /private/var/folders/fw/h4p8y9dx4y95nc0myyz75xvh0000gn/T/pana.1501251743113.uegBgf
INFO       Downloading package...
FINE       Package at /private/var/folders/fw/h4p8y9dx4y95nc0myyz75xvh0000gn/T/pana.1501251743113.uegBgf/hosted/pub.dartlang.org/dobx_ds-0.1.0
INFO       Counting files...
INFO       Checking formatting...
INFO       Checking pubspec.yaml...
INFO       Pub upgrade...
FINE       Running `/Users/syntern/work/google/pub/flutter/bin/flutter packages pub upgrade --verbosity io --no-precompile`...
INFO       Package version: 0.1.0
SEVERE     Could not create LibraryScanner
           Bad state: Could not determine package name for package at /private/var/folders/fw/h4p8y9dx4y95nc0myyz75xvh0000gn/T/pana.1501251743113.uegBgf/hosted/pub.dartlang.org/dobx_ds-0.1.0
           #0      new LibraryScanner (package:pana/src/library_scanner.dart:73:7)
           #1      PackageAnalyzer.inspectPackage (package:pana/pana.dart:153:17)
           <asynchronous suspension>
           #2      main (file:///Users/syntern/work/google/pub/pana.dart/bin/main.dart:83:36)
           <asynchronous suspension>
           #3      _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:263)
           #4      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151)
INFO       Analyzing package...
FINE       Running `/Users/syntern/work/google/pub/flutter/bin/flutter --version --machine`...

Use direct downloads of packages instead of using `pub cache`

We should directly download the packages from the normal https://pub.dartlang.org/packages/<name>/versions/<version>.tar.gz urls. Doing so will avoid running into the memcache issue. Furthermore it seems not particularly nice using the internal caching of pub for other purposes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.