mirror of
https://github.com/chenasraf/file_scaffold_dart.git
synced 2026-05-17 17:58:02 +00:00
static analysis fixes
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
include: package:pedantic/analysis_options.1.8.0.yaml
|
||||
include: package:pedantic/analysis_options.yaml
|
||||
|
||||
analyzer:
|
||||
exclude:
|
||||
|
||||
@@ -62,7 +62,7 @@ class FileScaffoldConfig {
|
||||
static String _getAbsolute(String path) =>
|
||||
isAbsolute(path) ? path : absolute(path);
|
||||
|
||||
static _mapTemplates(Iterable<dynamic> templates) => [
|
||||
static List<TemplateConfig> _mapTemplates(Iterable<dynamic> templates) => [
|
||||
for (dynamic template in templates)
|
||||
template is TemplateConfig
|
||||
? TemplateConfig(
|
||||
@@ -76,7 +76,7 @@ class FileScaffoldConfig {
|
||||
];
|
||||
|
||||
/// Makes a copy of this config, with the specified properties overridden.
|
||||
copyWith({
|
||||
FileScaffoldConfig copyWith({
|
||||
String name,
|
||||
List<String> templates,
|
||||
String outputDirectory,
|
||||
@@ -94,7 +94,7 @@ class FileScaffoldConfig {
|
||||
factory FileScaffoldConfig.fromArgs(List<String> args) {
|
||||
var parser = FileScaffoldConfig.argParser;
|
||||
var results = parser.parse(args);
|
||||
Map<String, dynamic> locals = {};
|
||||
var locals = <String, dynamic>{};
|
||||
for (String local in results['locals']) {
|
||||
var k = local.substring(0, local.indexOf('='));
|
||||
var v = local.substring(local.indexOf('=') + 1);
|
||||
|
||||
@@ -23,7 +23,7 @@ class FileScaffold {
|
||||
|
||||
/// Lists all file paths for a given [TemplateConfig].
|
||||
Stream<String> inputFiles(TemplateConfig template) async* {
|
||||
Glob glob = Glob(template.pattern);
|
||||
var glob = Glob(template.pattern);
|
||||
await for (FileSystemEntity file in glob.list()) {
|
||||
if (!Directory(file.path).existsSync()) {
|
||||
yield absolute(file.path);
|
||||
@@ -38,8 +38,8 @@ class FileScaffold {
|
||||
/// then outputting the new contents to the [config.outputDirectory].
|
||||
Future<void> run() async {
|
||||
for (var template in templates) {
|
||||
await for (String file in inputFiles(template)) {
|
||||
await _parseFile(template, file);
|
||||
await for (var file in inputFiles(template)) {
|
||||
unawaited(_parseFile(template, file));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ class FileScaffold {
|
||||
);
|
||||
}
|
||||
|
||||
_parseFile(TemplateConfig template, String file) async {
|
||||
Future<void> _parseFile(TemplateConfig template, String file) async {
|
||||
print('Parsing: $file');
|
||||
|
||||
if (!await File(file).exists()) {
|
||||
|
||||
Reference in New Issue
Block a user