essential_codemod 0.1.5

  • Readme
  • Changelog
  • Installing
  • 38

essential_codemod #

A utility for code modification, to implement json serialization methods

This codemod runs through your codebase and performs these refactors so you don't have to!

Installation #

essential_codemod provides an executable via dart global packages.

In your terminal:

pub global activate essential_codemod 

Usage #

cd path/to/your/code
pub global run essential_codemod:codechange

Arguments #

    --[no-]recursive    Apply updates to Dart files in the current directory and all subdirectories recursively.
                        (defaults to on)

    --[no-]classes      Use Stream classes instead of Rx factories. Example: "TimerStream" instead of "Rx.timer"
                        (defaults to off)

-h, --help              Prints the help menu

0.1.5 #

  • Convert myStream as Observable<int> to myStream

0.1.4 #

  • Remove debug print statement

0.1.3 #

  • Add two missing SimpleTypeConverters

0.1.2 #

  • Fix arguments

0.1.1 #

  • Fix docs

0.1.0 #

  • Initial version
  • Converts RxDart 0.22.x to 0.23.x

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate essential_codemod

2. Use it

The package has the following executables:


$ codechange

Use this package as a library

1. Depend on it

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


dependencies:
  essential_codemod: ^0.1.5

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:essential_codemod/helpers/file_manager.dart';
import 'package:essential_codemod/helpers/logging.dart';
import 'package:essential_codemod/modifiers/code_template.dart';
import 'package:essential_codemod/modifiers/implements_json_serialization.dart';
import 'package:essential_codemod/modifiers/patch.dart';
import 'package:essential_codemod/modifiers/scan_class_models.dart';
import 'package:essential_codemod/type_definictions/core_types.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
90
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
55
Overall:
Weighted score of the above. [more]
38
Learn more about scoring.

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

  • Dart: 2.8.4
  • pana: 0.13.15

Analysis suggestions

Package not compatible with runtime flutter-web on Web

Because:

  • package:essential_codemod/helpers/file_manager.dart that imports:
  • package:essential_codemod/modifiers/patch.dart that imports:
  • package:essential_codemod/helpers/logging.dart that imports:
  • package:io/ansi.dart that imports:
  • package:io/src/ansi_code.dart that imports:
  • dart:io

Package not compatible with runtime js

Because:

  • package:essential_codemod/helpers/file_manager.dart that imports:
  • package:essential_codemod/modifiers/patch.dart that imports:
  • package:essential_codemod/helpers/logging.dart that imports:
  • package:io/ansi.dart that imports:
  • package:io/src/ansi_code.dart that imports:
  • dart:io

Health suggestions

Fix bin/codechange.dart. (-3.93 points)

Analysis of bin/codechange.dart reported 8 hints, including:

line 2 col 8: Unused import: 'package:path/path.dart'.

line 3 col 8: Unused import: 'package:args/args.dart'.

line 4 col 8: Unused import: 'package:codemod/codemod.dart'.

line 5 col 8: Unused import: 'package:essential_codemod/modifiers/scan_class_models.dart'.

line 10 col 1: 'package:analyzer/analyzer.dart' is deprecated and shouldn't be used.

Fix lib/modifiers/implements_json_serialization.dart. (-2.48 points)

Analysis of lib/modifiers/implements_json_serialization.dart reported 5 hints:

line 12 col 50: Use ; instead of {} for empty constructor bodies.

line 61 col 11: The value of the local variable 'methodName' isn't used.

line 62 col 11: The value of the local variable 'source' isn't used.

line 76 col 11: The value of the local variable 'propertyName' isn't used.

line 125 col 9: The value of the local variable 'isExistToJson' isn't used.

Fix lib/helpers/file_manager.dart. (-1.99 points)

Analysis of lib/helpers/file_manager.dart reported 4 hints:

line 2 col 8: Unused import: 'dart:collection'.

line 7 col 8: Unused import: 'dart:math'.

line 9 col 8: Unused import: 'package:io/ansi.dart'.

line 12 col 8: Unused import: '../helpers/logging.dart'.

Fix additional 5 files with analysis or formatting issues. (-1.49 points)

Additional issues in the following files:

  • lib/modifiers/scan_class_models.dart (3 hints)
  • lib/helpers/logging.dart (Run dartfmt to format lib/helpers/logging.dart.)
  • lib/modifiers/code_template.dart (Run dartfmt to format lib/modifiers/code_template.dart.)
  • lib/modifiers/patch.dart (Run dartfmt to format lib/modifiers/patch.dart.)
  • lib/type_definictions/core_types.dart (Run dartfmt to format lib/type_definictions/core_types.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (analyzer, codemod).

The package description is too short. (-15 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and essential_codemod.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
analyzer >=0.37.0 <0.39.0 0.38.5 0.39.13
args >=1.5.1 <2.0.0 1.6.0
codemod >=0.1.5 <0.2.0 0.1.5 0.2.0
io ^0.3.3 0.3.4
logging ^0.11.4 0.11.4
meta ^1.1.8 1.2.2 1.3.0-nullsafety
path ^1.6.4 1.7.0
source_span >=1.4.1 <2.0.0 1.7.0
stack_trace ^1.9.3 1.9.5
Transitive dependencies
async 2.4.2
charcode 1.1.3
collection 1.14.13 1.15.0-nullsafety
convert 2.1.1
crypto 2.1.5
csslib 0.16.1
front_end 0.1.27 0.1.29
glob 1.2.0
html 0.14.0+3
js 0.6.2
kernel 0.3.27 0.3.29
node_interop 1.1.1
node_io 1.1.1
package_config 1.9.3
pub_semver 1.4.4
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0 1.3.0-nullsafety
watcher 0.9.7+15
yaml 2.2.1
Dev dependencies
coverage >=0.13.0 <0.14.0
pedantic ^1.8.0 1.9.2
test ^1.6.0