fluvie_validate 0.1.9
fluvie_validate: ^0.1.9 copied to clipboard
Static validation for Fluvie composition code: analyzer diagnostics plus the fluvie_lints rules, run in-process and never executing the code.
fluvie_validate #
Static validation for Fluvie composition code.
It resolves a snippet against package:fluvie and reports the compiler
diagnostics plus the fluvie_lints rules.
It analyzes only: it never compiles the code to an executable or runs it, so
validating an untrusted snippet is safe.
Usage #
import 'dart:io';
import 'package:fluvie_validate/fluvie_validate.dart';
Future<void> main() async {
final analyzer = FluvieCodeAnalyzer(projectRoot: Directory.current);
final diagnostics = await analyzer.analyze('''
import 'package:fluvie/fluvie.dart';
Video build() => Video(scenes: const []);
''');
if (diagnostics.isEmpty) {
stderr.writeln('No problems.');
} else {
for (final diagnostic in diagnostics) {
stderr.writeln(diagnostic);
}
}
}
projectRoot is any directory whose package resolution can see package:fluvie
(the workspace root works). This package backs the validate path in
fluvie_server and the Fluvie Playground.