move the analysis_options to a file
This commit is contained in:
@@ -274,43 +274,10 @@ class AnalyzeCommand extends FlutterCommand {
|
||||
for (String package in packages.keys)
|
||||
packagesBody.writeln('$package:${path.toUri(packages[package])}');
|
||||
|
||||
/// Specify analysis options.
|
||||
/// Note that until there is a default "all-in" lint rule-set we need
|
||||
/// to opt-in to all desired lints (https://github.com/dart-lang/sdk/issues/25843).
|
||||
/// For a list of lints, see: http://dart-lang.github.io/linter/lints/
|
||||
String optionsBody = '''
|
||||
analyzer:
|
||||
errors:
|
||||
# we allow overriding fields (if they use super, ideally...)
|
||||
strong_mode_invalid_field_override: ignore
|
||||
# we allow type narrowing
|
||||
strong_mode_invalid_method_override: ignore
|
||||
todo: ignore
|
||||
linter:
|
||||
rules:
|
||||
- always_declare_return_types
|
||||
# we'll turn on avoid_as as soon as it doesn't complain about "as dynamic"
|
||||
# - avoid_as
|
||||
- camel_case_types
|
||||
# sometimes we have no choice (e.g. when matching other platforms)
|
||||
# - constant_identifier_names
|
||||
- empty_constructor_bodies
|
||||
# disabled until regexp fix is pulled in (https://github.com/flutter/flutter/pull/1996)
|
||||
# - library_names
|
||||
- library_prefixes
|
||||
- non_constant_identifier_names
|
||||
# too many false-positives; code review should catch real instances
|
||||
# - one_member_abstracts
|
||||
- slash_for_doc_comments
|
||||
- super_goes_last
|
||||
- type_init_formals
|
||||
- unnecessary_brace_in_string_interp
|
||||
''';
|
||||
|
||||
// save the Dart file and the .packages file to disk
|
||||
Directory host = Directory.systemTemp.createTempSync('flutter-analyze-');
|
||||
File mainFile = new File(path.join(host.path, 'main.dart'))..writeAsStringSync(mainBody.toString());
|
||||
File optionsFile = new File(path.join(host.path, '_analysis.options'))..writeAsStringSync(optionsBody.toString());
|
||||
File optionsFile = new File(path.join(ArtifactStore.flutterRoot, 'packages', 'flutter_tools', '.analysis_options'));
|
||||
File packagesFile = new File(path.join(host.path, '.packages'))..writeAsStringSync(packagesBody.toString());
|
||||
|
||||
List<String> cmd = <String>[
|
||||
@@ -648,7 +615,7 @@ class PackageDependencyTracker {
|
||||
result.writeln('Package "$package" has conflicts:');
|
||||
packages[package].describeConflict(result);
|
||||
}
|
||||
return result.toString();
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
Map<String, String> asPackageMap() {
|
||||
|
||||
Reference in New Issue
Block a user