Giter Site home page Giter Site logo

tuneup.dart's Introduction

Dart pub package

A command-line tool to manipulate and inspect your Dart projects.

Update: Discontinued

Note, this package has been discontinued. Since tuneup was initially created the dart command line tool has largely supplanted this tool's functionality (with dart create, dart analyze, ...).

The discontinuation (and any discussion about it) can be tracked at #96.

Installing

To install, run:

dart pub global activate tuneup

Running

Run tuneup --help (or dart pub global run tuneup --help) to see a list of available commands.

  • init: create a new project
  • check: analyze all the source code in the project - fail if there are any errors (this is the default action)
  • stats: display metadata and statistics about the project
  • trim: trim unwanted whitespace from your source
  • clean: clean the project (remove the build/ directory)

Then run a tuneup command, like check:

dart pub global run tuneup check

or,

tuneup check

from the root of your project.

Filing Issues

Please file reports on the GitHub Issue Tracker.

Disclaimer

This is not an official Google product.

tuneup.dart's People

Contributors

devoncarew avatar guillermooo avatar himanshuranjan30 avatar johnpryan avatar jonas-sander avatar joseluis 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

tuneup.dart's Issues

tuneup throws for directories w/o pubspecs

FileSystemException: Cannot open file, path = '/Users/devoncarew/projects/flutter/flutter/packages/pubspec.yaml' (OS Error: No such file or directory, errno = 2)
#0      _File.throwIfError (dart:io/file_impl.dart:599)
#1      _File.openSync (dart:io/file_impl.dart:454)
#2      _File.readAsBytesSync (dart:io/file_impl.dart:514)
#3      _File.readAsStringSync (dart:io/file_impl.dart:548)
#4      Project.pubspec (package:tuneup/src/common.dart:103)
#5      Project.name (package:tuneup/src/common.dart:86)
#6      CheckCommand.execute (package:tuneup/commands/check.dart:25)
<asynchronous suspension>
#7      TuneupCommand.run (package:tuneup/src/common.dart:33)
#8      CommandRunner.runCommand (package:args/command_runner.dart:194)
<asynchronous suspension>

local_auth ^0.6.3+4 is incompatible with flutter_localizations from sdk.

Running "flutter pub get" in xysmart...
Because no versions of local_auth match >0.6.3+4 <0.7.0 and local_auth 0.6.3+4 depends on intl >=0.15.1 <0.17.0, local_auth ^0.6.3+4 requires intl >=0.15.1 <0.17.0.
And because every version of flutter_localizations from sdk depends on intl 0.17.0-nullsafety.2, local_auth ^0.6.3+4 is incompatible with flutter_localizations from sdk.
So, because xysmart depends on both flutter_localizations any from sdk and local_auth ^0.6.3+4, version solving failed.
pub get failed (1; So, because xysmart depends on both flutter_localizations any from sdk and local_auth ^0.6.3+4, version solving failed.)

plugin system

"trim" commands seems like too specific, comparing to all others
does it make sense to introduce a plugin system to make it possible to introduce third-party commands which will be wired with tuneup nicely?

If all enum values are handled in a switch it should not create a waning

This function declares a return type of 'CommitRequestMode', but does not end with a return statement at lib/src/convert_to_datastore.dart, line 23.

  enum CommitRequestMode { transactional, nonTransactional }

  String commitRequestMode(
      model.CommitRequestMode mode) {
    switch (mode) {
      case model.CommitRequestMode.nonTransactional:
        return 'NON_TRANSACTIONAL';
      case model.CommitRequestMode.transactional:
        return 'TRANSACTIONAL';
    }
  }

How is this package related to https://github.com/dart-lang/linter? Seems to have a large overlapping set of features.

add a --watch mode?

Add a --watch mode to tuneup? This would:

  • be a long lived process
  • print out all errors on startup
  • watch for file system changes
  • print out the diff of errors as files change. So, error 'foo' fixed, error 'bar' added

This would be a useful mode for people that didn't have analysis integration into their IDE.

discontinuing this package

We plan to discontinue this package. Since tuneup was initially created the dart command line tool has largely supplanted this tool's functionality (with dart create, dart analyze, ...).

This issue can serve as notice of the continuation as well as discussion for various replacement options (mostly, the dart command line tool).

`tuneup check` reports problems, but `dartanalyzer` doesn't

Checking project bwu_polymer_routing...
3 issues found; analyzed 9 source files in 19.2s.

[warning] The argument type 'BindView (/home/myuser/dart/bwu_polymer_routing/lib/bind_view.dart)' cannot be assigned to the parameter type 'BindView (/home/myuser/dart/bwu_polymer_routing/lib/bind_view.dart)' at lib/bind_view.dart, line 46.
[warning] The argument type 'BindView (/home/myuser/dart/bwu_polymer_routing/lib/bind_view.dart)' cannot be assigned to the parameter type 'BindView (/home/myuser/dart/bwu_polymer_routing/lib/bind_view.dart)' at lib/bind_view.dart, line 61.
[info] The argument type 'View (/home/myuser/dart/bwu_polymer_routing/lib/src/routing.dart)' cannot be assigned to the parameter type 'View (/home/myuser/dart/bwu_polymer_routing/lib/src/routing.dart)' at lib/src/routing.dart, line 163.

source: https://github.com/bwu-dart/bwu_polymer_routing
Dart VM version: 1.11.0-edge.c67f93099fa3ac3e6a80e08517c16fe0df842806 (Mon Jun 8 18:22:56 2015) on "linux_x64"
grind analyze runs the analyzer

tuneup check: null reference error

$ pub global activate tuneup
Resolving dependencies...
+ analyzer 0.25.0+1
+ args 0.13.0
+ cli_util 0.0.1+1
+ collection 1.1.0
+ path 1.3.5
+ source_span 1.1.2
+ stack_trace 1.3.1
+ string_scanner 0.1.3+1
+ tuneup 0.0.5+4
+ watcher 0.9.5
+ when 0.2.0
+ which 0.1.3
+ yaml 2.1.2
Downloading tuneup 0.0.5+4...
Downloading yaml 2.1.2...
Downloading analyzer 0.25.0+1...
Downloading args 0.13.0...
Precompiling executables...
Loading source assets...
Precompiled tuneup:tuneup.
Activated tuneup 0.0.5+4.
Installed executable tuneup.

$ tuneup check
Checking project unscripted...
Unhandled exception:
AnalysisException: <rethrow>
Caused by The null object does not have a setter 'evaluationResult='.

NoSuchMethodError: method not found: 'evaluationResult='
Receiver: null
Arguments: [Instance of 'EvaluationResultImpl']
#0      AnalysisTask._safelyPerform (package:analyzer/src/generated/engine.dart:6434)
#1      AnalysisTask.perform (package:analyzer/src/generated/engine.dart:6403)
#2      AnalysisContextImpl._cacheDartResolutionData (package:analyzer/src/generated/engine.dart:2804)
#3      AnalysisContextImpl._getDartResolutionData (package:analyzer/src/generated/engine.dart:3413)
#4      AnalysisContextImpl.computeErrors (package:analyzer/src/generated/engine.dart:1605)
#5      CheckCommand.execute (package:tuneup/src/check_command.dart:63)
#6      Tuneup.processArgs (package:tuneup/tuneup.dart:117)
#7      main (http://localhost:55191/tuneup.dart:14)
#8      _startIsolate (dart:isolate-patch/isolate_patch.dart:237)
#9      _startMainIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:192)
#10     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:130)

Caused by The null object does not have a setter 'evaluationResult='.

NoSuchMethodError: method not found: 'evaluationResult='
Receiver: null
Arguments: [Instance of 'EvaluationResultImpl']
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#1      ConstantValueComputer._computeValueFor (package:analyzer/src/generated/constant.dart:692)
#2      ConstantValueComputer.computeValues (package:analyzer/src/generated/constant.dart:558)
#3      LibraryResolver._performConstantEvaluation.<anonymous closure> (package:analyzer/src/generated/resolver.dart:8458)
#4      _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:150)
#5      LibraryResolver._performConstantEvaluation (package:analyzer/src/generated/resolver.dart:8441)
#6      LibraryResolver.resolveLibrary (package:analyzer/src/generated/resolver.dart:7911)
#7      ResolveDartLibraryTask.internalPerform (package:analyzer/src/generated/engine.dart:10538)
#8      AnalysisTask._safelyPerform (package:analyzer/src/generated/engine.dart:6430)
#9      AnalysisTask.perform (package:analyzer/src/generated/engine.dart:6403)
#10     AnalysisContextImpl._cacheDartResolutionData (package:analyzer/src/generated/engine.dart:2804)
#11     AnalysisContextImpl._getDartResolutionData (package:analyzer/src/generated/engine.dart:3413)
#12     AnalysisContextImpl.computeErrors (package:analyzer/src/generated/engine.dart:1605)
#13     CheckCommand.execute (package:tuneup/src/check_command.dart:63)
#14     Tuneup.processArgs (package:tuneup/tuneup.dart:117)
#15     main (http://localhost:55191/tuneup.dart:14)
#16     _startIsolate (dart:isolate-patch/isolate_patch.dart:237)
#17     _startMainIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:192)
#18     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:130)


#0      AnalysisContextImpl.recordResolveDartLibraryTaskResults (package:analyzer/src/generated/engine.dart:2496)
#1      AnalysisContextImpl_AnalysisTaskResultRecorder.visitResolveDartLibraryTask (package:analyzer/src/generated/engine.dart:4866)
#2      ResolveDartLibraryTask.accept (package:analyzer/src/generated/engine.dart:10530)
#3      AnalysisTask.perform.<anonymous closure> (package:analyzer/src/generated/engine.dart:6411)
#4      _PerformanceTagImpl.makeCurrentWhile (package:analyzer/src/generated/utilities_general.dart:150)
#5      AnalysisTask.perform (package:analyzer/src/generated/engine.dart:6411)
#6      AnalysisContextImpl._cacheDartResolutionData (package:analyzer/src/generated/engine.dart:2804)
#7      AnalysisContextImpl._getDartResolutionData (package:analyzer/src/generated/engine.dart:3413)
#8      AnalysisContextImpl.computeErrors (package:analyzer/src/generated/engine.dart:1605)
#9      CheckCommand.execute (package:tuneup/src/check_command.dart:63)
#10     Tuneup.processArgs (package:tuneup/tuneup.dart:117)
#11     main (http://localhost:55191/tuneup.dart:14)
#12     _startIsolate (dart:isolate-patch/isolate_patch.dart:237)
#13     _startMainIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:192)
#14     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:130)

Could not resolve URI and Canonical failed

Hello,
I tried this package to analyze my dart package on Windows.

Here is what I see with version 0.1.3 and 0.1.2:

Could not resolve URI (translations.dart) relative to source (C:\Users\xxx\black_cats\lib\scene.dart)
Canonical failed: C:\Users\xxx\black_cats\packages\_assets_gen
Internal error while performing the task: get contents of C:\Users\xxx\black_cats\packages\_assets_gen\scene.g.dart
Could not resolve URI (../scene.dart) relative to source (C:\xxx\black_cats\lib\_assets_gen\scene.g.dart)
37 issues found; analyzed 9 source files in 12.6s.

It works with older versions (<=0.1.1+1)

This happens for all my packages. It reports a lots of errors.

Tuneup suddenly dislikes pedantic

Hey @devoncarew,

For some reason, I'm hitting an issue with tuneup taking a sudden dislike to pedantic:

analyze
  /Users/brettmorgan/homebrew/Cellar/dart/2.10.4/libexec/bin/pub run tuneup check
  Checking project dart_services...
  
    warning - The include file package:pedantic/analysis_options.yaml in /Users/brettmorgan/Documents/GitHub/dart-services/analysis_options.yaml cannot be found at analysis_options.yaml:1:11 - (include_file_not_found)
  
  1 issue found; analyzed 109 source files in 9.0s.

failed with exit code 1
#0      run (package:grinder/src/run.dart:48:5)
#1      Pub.run (package:grinder/grinder_sdk.dart:241:12)
#2      analyze (file:///Users/brettmorgan/Documents/GitHub/dart-services/tool/grind.dart:26:7)
#3      _LibraryMirror._invoke (dart:mirrors-patch/mirrors_impl.dart:1089:36)
#4      _ObjectMirror.invoke (dart:mirrors-patch/mirrors_impl.dart:242:25)
#5      TaskDiscovery.discoverDeclaration.<anon> (package:grinder/src/discover_tasks.dart:77:38)
#6      _rootRun (dart:async/zone.dart:1190:13)
#7      _CustomZone.run (dart:async/zone.dart:1093:19)
#8      _runZoned (dart:async/zone.dart:1630:10)
#9      runZoned (dart:async/zone.dart:1550:10)
#10     ZonedValue.withValue (package:grinder/src/utils.dart:113:12)
#11     GrinderTask.execute (package:grinder/src/grinder_task.dart:63:27)
#12     Grinder._invokeTask (package:grinder/src/grinder.dart:193:27)
#13     Grinder.start.<anon> (package:grinder/src/grinder.dart:168:16)
#14     Future.forEach.<anon> (dart:async/future.dart:512:26)
#15     Future.doWhile.<anon> (dart:async/future.dart:554:26)
#16     _RootZone.runUnaryGuarded (dart:async/zone.dart:1384:10)
#17     _RootZone.bindUnaryCallbackGuarded.<anon> (dart:async/zone.dart:1423:26)
#18     _RootZone.runUnary (dart:async/zone.dart:1450:54)
#19     _FutureListener.handleValue (dart:async/future_impl.dart:143:18)
#20     Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:696:45)
#21     Future._propagateToListeners (dart:async/future_impl.dart:725:32)
#22     Future._completeWithValue (dart:async/future_impl.dart:529:5)
#23     _AsyncAwaitCompleter.complete (dart:async-patch/async_patch.dart:40:15)
#24     _completeOnAsyncReturn (dart:async-patch/async_patch.dart:311:13)
#25     generateProtos (file:///Users/brettmorgan/Documents/GitHub/dart-services/tool/grind.dart)

Any ideas on how to debug this?

brett

flutter_localizations from sdk is incompatible with tuneup

flutter_localizations from sdk is incompatible with tuneup

flutter packages get
Running "flutter pub get" in awesome1c...                       
Because every version of flutter_localizations from sdk depends on intl 0.16.1 and tuneup >=0.3.6 depends on intl ^0.15.0, flutter_localizations from sdk is incompatible with tuneup >=0.3.6.

So, because awesome1c depends on both tuneup >=0.3.6 <1.0.0 and flutter_localizations any from sdk, version solving failed.
pub get failed (1; So, because awesome1c depends on both tuneup >=0.3.6 <1.0.0 and flutter_localizations any from sdk, version solving failed.)
exit code 1
[awesome1c] flutter packages get
Running "flutter pub get" in awesome1c...                       
The current Dart SDK version is 2.8.0-dev.20.10.



Because every version of flutter_localizations from sdk depends on intl 0.16.1 and tuneup >=0.3.6 depends on intl ^0.15.0, flutter_localizations from sdk is incompatible with tuneup >=0.3.6.


And because tuneup <0.3.6 requires SDK version >=1.0.0 <2.0.0, flutter_localizations from sdk is incompatible with tuneup.
So, because awesome1c depends on both tuneup any and flutter_localizations any from sdk, version solving failed.
pub get failed (1; So, because awesome1c depends on both tuneup any and flutter_localizations any from sdk, version solving failed.)
exit code 1

machine / CI friendly output

It would be great if tuneup supports a format that is already understood by some CI systems.
We use gitlab, which supports these:

Keyword Description
artifacts:reports:cobertura The cobertura report collects Cobertura coverage XML files.
artifacts:reports:codequality The codequality report collects CodeQuality issues.
artifacts:reports:container_scanning The container_scanning report collects Container Scanning vulnerabilities.
artifacts:reports:dast The dast report collects Dynamic Application Security Testing vulnerabilities.
artifacts:reports:dependency_scanning The dependency_scanning report collects Dependency Scanning vulnerabilities.
artifacts:reports:dotenv The dotenv report collects a set of environment variables.
artifacts:reports:junit The junit report collects JUnit XML files.
artifacts:reports:license_management The license_management report collects Licenses (removed from GitLab 13.0).
artifacts:reports:license_scanning The license_scanning report collects Licenses.
artifacts:reports:load_performance The load_performance report collects load performance metrics.
artifacts:reports:metrics The metrics report collects Metrics.
artifacts:reports:performance The performance report collects Browser Performance metrics.
artifacts:reports:sast The sast report collects Static Application Security Testing vulnerabilities.
artifacts:reports:terraform The terraform report collects Terraform tfplan.json files.

artifacts:reports:codequality could be beneficial, the artifacts required seem simple enough: https://docs.gitlab.com/ee/user/project/merge_requests/code_quality.html#implementing-a-custom-tool

The spec for the JSON supports a few more fields: https://gitlab.com/gitlab-org/gitlab-foss/-/issues/51676#code-quality-report-format - this could be helpful for other CI systems, too.

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.