analysis_utils 0.0.9

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

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.9

  • Added metadata, sourceLocations and docs functionality and testings for TopLevelVars

0.0.8

  • Added capacity of statically analyze only with analyzer (mirrors free)

0.0.6

  • Mocosoft free: repo en Gitlab

0.0.5

  • Add Uri resolving capabilities
  • Separated the code attribute in a getter (for "lazy loading")

0.0.4

  • isPrivate to MethodAnalysis

0.0.3

  • Boludeces para que ande, desestimar...

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 = [];

  double var1 = 2.0, initVal = 723 + 123 / 2;
}

main() {
  ClassAnalysis clazz = new ClassAnalysis.fromType(ExampleClass);
  print("The class name is: ${clazz.name}");
  print("The fields are: " + clazz.fields.keys.join(", "));
  print("The initial value of 'initVal' field is:"
      " ${clazz.fields['initVal'].defaultValue}");
  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.9

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.9 Oct 4, 2018 Go to the documentation of analysis_utils 0.0.9 Download analysis_utils 0.0.9 archive
0.0.7 Sep 3, 2018 Go to the documentation of analysis_utils 0.0.7 Download analysis_utils 0.0.7 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
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
44
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.5

Platforms

Detected platforms: other

Platform components identified in package: io, isolate, mirrors.

Health suggestions

Format lib/src/resolver.dart.

Run dartfmt to format lib/src/resolver.dart.

Maintenance issues and suggestions

Homepage does not exists. (-20 points)

We were unable to access https://www.gitlab.com/Rodsevich/analysis_utils at the time of the analysis.

Package is pre-v0.1 release. (-10 points)

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

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
analyzer >=0.32.1 <0.33.0 0.32.6 0.33.1
path ^1.6.2 1.6.2
source_span ^1.4.0 1.4.1
Transitive dependencies
args 1.5.0
async 2.0.8
charcode 1.1.2
collection 1.14.11
convert 2.0.2
crypto 2.0.6
csslib 0.14.6
front_end 0.1.4+2 0.1.6+1
glob 1.1.7
html 0.13.3+3
kernel 0.3.4+2 0.3.6+1
logging 0.11.3+2
meta 1.1.6
package_config 1.0.5
plugin 0.2.0+3
string_scanner 1.0.4
typed_data 1.1.6
utf 0.9.0+5
watcher 0.9.7+10
yaml 2.1.15
Dev dependencies
test >=1.0.0 <2.0.0