analysis_utils 0.0.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 50

analysis_utils

A library for facilitating the analysis of code integrating both dart:mirrors and analyzer packages (in the AST nodes facet)

Features

So far the library supports:

  • Documentation blocks parsing
  • source_span's in-file source locations
  • Annotations analysis and instantiation
  • Class Analysis
    • Method analysis
    • Field analysis
    • Constructor analysis

Usage

So far, the usage is ClassAnalysis oriented only:

import "package:analysis_utils/analysis.dart";

main(){
  ClassAnalysis typeAnalysis = new ClassAnalysis.fromType(Clazz);
  Clazz c = new Clazz();
  ClassAnalysis instanceAnalysis = new ClassAnalysis.fromInstance(c);
}

For more info you can see the example, test or documentation

Please file feature requests and bugs at the issue tracker.

Changelog

0.0.2

  • Arreglo de links en el readme
  • Dejar presentable y en inglés el código de ejemplo

0.0.1

  • Initial version, created by Stagehand

example/analysis_utils_example.dart

import 'package:analysis_utils/analysis.dart';

/// The classic documentation
/// comment is supported
class ExampleClass extends ParentClass {
  /** Also
   * this
   * kind
   * of
   * documentation
   * is
   * supported
   */
  int field1;
  String field2;

  void method1() {
    print("method1 executed");
  }

  /// Greet `name`
  String method2(String name) => "Hello $name";

  ExampleClass(String param1, int param2, [this.field1]);

  ExampleClass.withField2(this.field2);
}

//custom annotation, ain't a documentation comment, shouldn't be parsed, so
class annon {
  final int n;
  final String text;
  const annon(this.n, [this.text]);
}

class ParentClass {
  @annon(1, "sorp")
  @annon(2)
  @annon(3, "longa")
  @annon(4)
  List<int> sorp = [];
}

main() {
  ClassAnalysis clazz = new ClassAnalysis.fromType(ExampleClass);
  print("The class name is: ${clazz.name}");
  print("The fields are: " + clazz.fields.keys.join(", "));
  print("The methods are: " + clazz.methods.keys.join(", "));
  print("The constructors are: " + clazz.constructors.keys.join(", "));
  print(
      "  The default constructor has ${clazz.constructors[""].parameters.length} parameters:\n${clazz.constructors[""].parameters.all.map((Parameter p) => p.name).join(", ")}");
  print("The documentation for method2 is: " + clazz.methods["method2"].docs);
  print(
      "The inherintance preserves even the annotations from the parent class! (it has ${clazz.fields["sorp"].metadata.length} annotations)");
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  analysis_utils: "^0.0.3"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


      import 'package:analysis_utils/analysis.dart';

      import 'package:analysis_utils/annotation.dart';
  
Version Uploaded Documentation Archive
0.0.3 May 7, 2018 Go to the documentation of analysis_utils 0.0.3 Download analysis_utils 0.0.3 archive
0.0.2 May 4, 2018 Go to the documentation of analysis_utils 0.0.2 Download analysis_utils 0.0.2 archive
0.0.1 May 4, 2018 Go to the documentation of analysis_utils 0.0.1 Download analysis_utils 0.0.1 archive

Analysis

We analyzed this package on Jul 13, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
100 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
50
Learn more about scoring.

Platforms

Detected platforms: other

Platform components identified in package: io, mirrors.

Suggestions

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.1.2 <2.0.0
analyzer ^0.31.1 0.31.1 0.32.3
source_span ^1.4.0 1.4.0
Transitive dependencies
args 1.4.3
async 2.0.7
charcode 1.1.2
cli_util 0.1.3
collection 1.14.10
convert 2.0.1
crypto 2.0.5
csslib 0.14.4
front_end 0.1.0-alpha.9 0.1.3
glob 1.1.6
html 0.13.3+1
isolate 1.1.0 2.0.1
kernel 0.3.0-alpha.9 0.3.3
logging 0.11.3+1
meta 1.1.5
package_config 1.0.3
path 1.6.1
plugin 0.2.0+2
string_scanner 1.0.2
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+9
yaml 2.1.14
Dev dependencies
test ^0.12.0