Example config update and doc tweaks. (#653)
* Example config update and doc tweaks.
* Removed defunct test.
* Added TODO to update test.
diff --git a/example/all.yaml b/example/all.yaml
new file mode 100644
index 0000000..432489b
--- /dev/null
+++ b/example/all.yaml
@@ -0,0 +1,97 @@
+# Auto-generated options enabling all lints.
+# Add these to your `analysis-options.yaml` file and tailor to fit!
+linter:
+ rules:
+ - always_declare_return_types
+ - always_put_control_body_on_new_line
+ - always_require_non_null_named_parameters
+ - always_specify_types
+ - annotate_overrides
+ - avoid_annotating_with_dynamic
+ - avoid_as
+ - avoid_catches_without_on_clauses
+ - avoid_catching_errors
+ - avoid_classes_with_only_static_members
+ - avoid_empty_else
+ - avoid_function_literals_in_foreach_calls
+ - avoid_init_to_null
+ - avoid_null_checks_in_equality_operators
+ - avoid_positional_boolean_parameters
+ - avoid_return_types_on_setters
+ - avoid_returning_null
+ - avoid_returning_this
+ - avoid_setters_without_getters
+ - avoid_slow_async_io
+ - avoid_types_on_closure_parameters
+ - await_only_futures
+ - camel_case_types
+ - cancel_subscriptions
+ - cascade_invocations
+ - close_sinks
+ - comment_references
+ - constant_identifier_names
+ - control_flow_in_finally
+ - directives_ordering
+ - empty_catches
+ - empty_constructor_bodies
+ - empty_statements
+ - hash_and_equals
+ - implementation_imports
+ - invariant_booleans
+ - iterable_contains_unrelated_type
+ - join_return_with_assignment
+ - library_names
+ - library_prefixes
+ - list_remove_unrelated_type
+ - literal_only_boolean_expressions
+ - no_adjacent_strings_in_list
+ - no_duplicate_case_values
+ - non_constant_identifier_names
+ - omit_local_variable_types
+ - one_member_abstracts
+ - only_throw_errors
+ - overridden_fields
+ - package_api_docs
+ - package_names
+ - package_prefixed_library_names
+ - parameter_assignments
+ - prefer_adjacent_string_concatenation
+ - prefer_collection_literals
+ - prefer_conditional_assignment
+ - prefer_const_constructors
+ - prefer_constructors_over_static_methods
+ - prefer_contains
+ - prefer_expression_function_bodies
+ - prefer_final_fields
+ - prefer_final_locals
+ - prefer_foreach
+ - prefer_function_declarations_over_variables
+ - prefer_initializing_formals
+ - prefer_interpolation_to_compose_strings
+ - prefer_is_empty
+ - prefer_is_not_empty
+ - public_member_api_docs
+ - recursive_getters
+ - slash_for_doc_comments
+ - sort_constructors_first
+ - sort_unnamed_constructors_first
+ - super_goes_last
+ - test_types_in_equals
+ - throw_in_finally
+ - type_annotate_public_apis
+ - type_init_formals
+ - unawaited_futures
+ - unnecessary_brace_in_string_interps
+ - unnecessary_getters_setters
+ - unnecessary_lambdas
+ - unnecessary_null_aware_assignments
+ - unnecessary_null_in_if_null_operators
+ - unnecessary_overrides
+ - unnecessary_this
+ - unrelated_type_equality_checks
+ - use_rethrow_when_possible
+ - use_setters_to_change_properties
+ - use_string_buffers
+ - use_to_and_as_if_applicable
+ - valid_regexps
+
diff --git a/example/lintconfig.yaml b/example/lintconfig.yaml
deleted file mode 100644
index 631b422..0000000
--- a/example/lintconfig.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
-# Provisional lint config file format. Ongoing discussion here
-# https://github.com/dart-lang/linter/issues/41
-#
-# Comments welcome!
-
-files:
- include: foo/** # un-quoted
- exclude:
- - test/** # file globs can be scalars or lists
- - '**/_data.dart' # unquoted stars treated by YAML as aliases :(
-
-rules:
- style_guide:
- unnecessary_getters: false # disable
\ No newline at end of file
diff --git a/test/integration_test.dart b/test/integration_test.dart
index 4992dd5..3eb80e8 100644
--- a/test/integration_test.dart
+++ b/test/integration_test.dart
@@ -6,7 +6,6 @@
import 'dart:io';
-import 'package:analyzer/src/lint/config.dart';
import 'package:analyzer/src/lint/io.dart';
import 'package:analyzer/src/lint/linter.dart';
import 'package:mockito/mockito.dart';
@@ -113,31 +112,6 @@
});
});
- group('p8', () {
- IOSink currentOut = outSink;
- CollectingSink collectingOut = new CollectingSink();
- setUp(() {
- exitCode = 0;
- outSink = collectingOut;
- });
- tearDown(() {
- collectingOut.buffer.clear();
- outSink = currentOut;
- exitCode = 0;
- });
- group('config', () {
- test('filtered', () {
- dartlint
- .main(['test/_data/p8', '-c', 'test/_data/p8/lintconfig.yaml']);
- expect(exitCode, 0);
- expect(
- collectingOut.trim(),
- stringContainsInOrder(
- ['2 files analyzed, 0 issues found (1 filtered), in']));
- });
- });
- });
-
group('overridden_fields', () {
IOSink currentOut = outSink;
CollectingSink collectingOut = new CollectingSink();
@@ -446,20 +420,16 @@
});
});
- group('examples', () {
- test('lintconfig.yaml', () {
- var src = readFile('example/lintconfig.yaml');
- var config = new LintConfig.parse(src);
- expect(config.fileIncludes, unorderedEquals(['foo/**']));
- expect(
- config.fileExcludes, unorderedEquals(['**/_data.dart', 'test/**']));
- expect(config.ruleConfigs, hasLength(1));
- var ruleConfig = config.ruleConfigs[0];
- expect(ruleConfig.group, 'style_guide');
- expect(ruleConfig.name, 'unnecessary_getters');
- expect(ruleConfig.args, {'enabled': false});
- });
- });
+// group('examples', () {
+// test('all.yaml', () {
+//TODO(pq): update LintConfig to read analysis options format
+// var src = readFile('example/all.yaml');
+// var config = new LintConfig.parse(src);
+// List<String> configuredRules = config.ruleConfigs.map((c) => c.name).toList();
+// expect(configuredRules, unorderedEquals(Registry.ruleRegistry.map((r)=>r.name)));
+// });
+// });
+
});
}
diff --git a/tool/doc.dart b/tool/doc.dart
index b3cd496..ff0fb6b 100644
--- a/tool/doc.dart
+++ b/tool/doc.dart
@@ -37,8 +37,7 @@
or through an
[analysis options file](https://www.dartlang.org/guides/language/analysis-options#the-analysis-options-file).
-* **[An auto-generated list enabling all options is provided
-here.](options/options.html)**
+* **An auto-generated list enabling all options is provided [here](options/options.html).**
As some lints may contradict each other, only a subset of these will be
enabled in practice, but this list should provide a
@@ -344,7 +343,7 @@
<p>
Auto-generated options enabling all lints.
Add these to your
- [.analysis-options file](https://www.dartlang.org/guides/language/analysis-options#the-analysis-options-file)
+ <a href="https://www.dartlang.org/guides/language/analysis-options#the-analysis-options-file">analysis_options.yaml file</a>
and tailor to fit!
</p>