Command-line tool to provide null-safety percentage info of a project. Track your migration progress on mixed-version programs that execute with unsound null safety.

Overview

null_safety_percentage

Command-line tool to provide null-safety percentage info of a project. Track your migration progress on mixed-version programs that execute with unsound null safety.

Continuous Integration codecov null_safety_percentage Published by dartside.dev GitHub Stars Count

Important links

Motivation

A Dart program can contain some libraries that are null safe and some that aren’t. These mixed-version programs execute with unsound null safety. - Dart: Unsound null safety

For smaller projects, migrating to null safety can be done in a matter of minutes. Unfortunately, if you are not satisfied with the automatically migrated code and you want to do the migration on your own, the migration of large code-bases can take a while.

This command-line tool lets you track your progress of your null-safety migration.

Installation

Install the null_safety_percentage command-line tool either globally or as a dev dependency.

Global installation

If you install null_safety_percentage globally, you can execute it simply by typing null_safety_percentage lib test.

# Install globally
dart pub global activate null_safety_percentage
# or: flutter pub global activate null_safety_percentage

# Verify installation was successful
null_safety_percentage --help

As dev dependency

You can run Dart scripts from your dependencies using the dart run or flutter run command.

Flutter project

  1. Add null_safety_percentage to your dev_dependencies: flutter pub add -d null_safety_percentage.
  2. Run the script flutter run null_safety_percentage lib test. See more example in the "Usage" section below.

Dart project

  1. Add null_safety_percentage to your dev_dependencies: dart pub add -d null_safety_percentage.
  2. Run the script dart run null_safety_percentage lib test. See more example in the "Usage" section below.

Usage

Keep in mind that how you invoke the null_safety_percentage depends on how you installed it and whether you are using it from a Flutter or Dart project. The usage examples below assume you installed the package globally.

# See usage and other info about the package
null_safety_percentage --help
null_safety_percentage -h

# One folder
null_safety_percentage lib

# Multiple folders
null_safety_percentage lib test

# Custom output format: JSON
null_safety_percentage --output-format=json lib test
null_safety_percentage --output-format json lib test

# Custom output format: ASCII (perfect with UNIX/Shell tools)
null_safety_percentage --output-format ascii lib test

# Get version info
null_safety_percentage --version

The tool supports multiple output formats, so for example if you want to add a check in your CI/CD tool to ensure that your "null-safety coverage percentage" metrics are not getting worse, you can use the "ascii" format, then take the metric you are interested in.

Caveats

The tool is in its early phases and is written so that it runs correctly on the projects I am working on.

Currently, the way the tool decides whether a file counts as migrated or not is pretty rudimentary. I assume there must be better ways to get this information, but this approach worked well enough for me. Improvements, recommendations are welcome.

The tool is not going to work on totally unmigrated libraries. I didn't want to add safe-guards against that, so please make sure that the "input" project is at least partially migrated.

example

Don't forget the project's example folder for a project where you can test the command-line tool.

You might also like...

A flutter plugin for execute dart code in background.

flutter_background_service A flutter plugin for execute dart code in background. Android No additional setting required. To change notification icon,

Dec 27, 2022

A set of commands for coverage info files manipulation.

Coverage Utils A set of commands for coverage info files manipulation. Installing $ dart pub global activate

Oct 9, 2022

Official Git of flutter code-push made by Chimera inc. If you want to get more info or seek for biz corporation, you can contact [email protected].

中文版 Chimera Flutter Code Push Chimera is a Dart compiler developed by ourselves, which generates interpretable and executable bytecode to implement co

Oct 6, 2022

Simple CLI tool to produce icons for your next app.

icon_set_generator Simple CLI tool to enable easy production of icon sets for your next application. Installation Clone the repo and add bin/icon_set_

Nov 17, 2021

A Flutter curl-command generator for Dio

A Flutter curl-command generator for Dio

curl_logger_dio_interceptor A Flutter curl-command generator for Dio. Easily test your Flutter-made requests in your favorite terminal or even in Post

Nov 17, 2022

Provide route generator to create route map quickly by annotations.

ff_annotation_route Languages: English | 中文简体 Description Provide a route generator to create route map quickly by annotations. ff_annotation_route De

Nov 25, 2022

A few handy Flutter tools, dead simple `UriRouter` for `Uri`-based navigator or `BuildTracker` to track widget rebuilds and what caused them to rebuild.

noob A few handy tools for Flutter apps. UriRouter Hooks Providers PointerIndicator BuildTracker PeriodicListenable UriRouter Dead simple Uri-based pa

Jan 18, 2022

Flutter Version Management: A simple CLI to manage Flutter SDK versions.

Flutter Version Management: A simple CLI to manage Flutter SDK versions.

fvm Flutter Version Management: A simple cli to manage Flutter SDK versions. FVM helps with the need for a consistent app builds by allowing to refere

Jan 8, 2023

Dart language version of Persian-Tools

Dart language version of Persian-Tools

Persian tools Persian Tools dart package which you can use in all platforms Features Adding ordinal suffixes Converting Persian words to number Conver

Dec 29, 2022
Comments
  • Add integration tests

    Add integration tests

    Currently, we only have unit tests, and a small but very important part of the app (the file in bin) is not tested.

    We could create an integration test that checks reading files, and all the calculations.

    opened by vincevargadev 0
Owner
dartside.dev
Hacking on Flutter and Dart.
dartside.dev
A tool to easily install the Android SDK command-line and platform tools.

gibadb A tool to easily install the Android SDK command-line and platform tools. For developers: This README describes the CLI tool that ships with th

null 3 Sep 22, 2022
Provides null-safety implementation to simplify JSON data handling by adding extension method to JSON object

Lazy JSON Provides null-safety implementation to simplify JSON data handling by adding extension method to JSON object and JSON array. Getting started

Kinnara Digital Studio 0 Oct 27, 2021
A Very Good Command Line Interface for Dart created by Very Good Ventures 🦄

Very Good CLI Developed with ?? by Very Good Ventures ?? A Very Good Command Line Interface for Dart. Installing $ dart pub global activate very_good_

Very Good Open Source 1.8k Jan 8, 2023
A command-line interface for Ultroid

UltroidCli Welcome to the UltroidCli project built for The Ultroid. This Project is actively maintained by Akash Pattnaik. All kinds of contributions

AkashPattanaik 38 Nov 13, 2022
Easy to use cross-platform regex replace command line util

replace Easy to use cross-platform regex replace command line util. Can't remember the arguments to the find command? or how xargs works? Maybe sed is

Rob Becker 3 Feb 1, 2022
A simple command-line application to generate simple folder and file structure for Flutter Applications

Kanza_cli is a simple command line tool to generate folder and file structure for your Flutter apps. To use it, you should do the followings: 1. First

Kanan Yusubov 9 Dec 16, 2022
Command-line Interface (CLI) for any_icon_maker.

makeanyicon Command-line Interface (CLI) for any_icon_maker. makeanyicon Quick Start Installation Usage License Quick Start Installation dart pub glob

MakeAnyIcon 6 Nov 4, 2022
Uproot(uprt) is a multi-platform (Windows, MacOs, and Linux) command line utility written in Dart to convert a router's DHCP IP Reservations between routers

UPROOT Uproot(uprt) is a multi-platform (Windows, MacOs, and Linux) command line utility written in Dart to convert a router's DHCP IP Reservations be

GeekVisit 73 Jan 1, 2023
A simple shortcut, command line interface (CLI) for a lazy (a.k.a effective) Flutter developer in order to increase productivity and happiness.

f A simple shortcut, command line interface (CLI) for a lazy (a.k.a effective) Flutter developer in order to increase productivity and happiness. Inst

Salman S 27 Nov 22, 2022
Arissounddart - a Command-line SoundSprite generator for Dart

SoundDart SoundDart is a Command-line SoundSprite generator for Dart. It require

Behruz Hurramov 1 Jan 9, 2022