Codemetrics for Dart is a simple command line utility that provides some insight into the "quality" of code.
It uses static analysis of the code to determine:
and provides different reporting serialization formats:
For now, there is no pub package for this project, so you have to clone it
git clone https://github.com/daniel-v/codemetrics.git cd codemetrics pub get cd bin; dart codemetrics.dart --analysis-root=/path/to/your/package
You can also install it as a global package:
pub global activate --source git https://github.com/daniel-v/codemetrics.git
Executable name is
For html output use the --report-format=html and for JSON use --report-format=json. A full command could look like this:
dart bin/codemetrics.dart --analysis-root=/path/to/your/package --report-format=html > /tmp/test.html
There are number of areas you can contribute to this project:
For a high level overview of what CodeMetrics is, please read README.md
Please keep in mind, this is the first preview release of the software, things might break or might not function as intended
You can install the package from the command line:
$ pub global activate codemetrics
The package has the following executables:
Add this to your package's pubspec.yaml file:
dependencies: codemetrics: "^1.0.0-alpha"
You can install packages from the command line:
$ pub get
$ flutter packages get
Alternatively, your editor might support
pub get or
flutter packages get.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|1.0.0-alpha||Jun 2, 2018|
We analyzed this package on Jun 19, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Detected platforms: Flutter, other
Package is pre-release.
Pre-release versions should be used with caution, their API may change in breaking ways.
Fix analysis and formatting issues.
Analysis or formatting checks reported 8 hints.
Strong-mode analysis of
lib/analyzer/src/cyclomatic_impl.dartgave the following hint:
line: 117 col: 3
This function declares a return type of 'Map<String, dynamic>', but doesn't end with a return statement.
Strong-mode analysis of
lib/cyclomatic/cyclomatic.dartgave the following hint:
line: 5 col: 1
'analyzer.src.generated.scanner' is deprecated and shouldn't be used.
Similar analysis of the following files failed:
Maintain an example.
Create a short demo in the
example/directory to show how to use this package. Common file name patterns include:
example.dartor you could also use
|Dart SDK||>=2-0-0-dev <2.0.0|