diff --git a/CHANGELOG.md b/CHANGELOG.md index b8fa2c1..36d7c3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.7.0 + +- Add versioned `analysis_options.yaml` files to the package so it's possible + to pin to a version without also pinning the pub dependency. See `README.md` + for updated usage guide. + ## 1.6.0 - Enforce six new lint rules: diff --git a/README.md b/README.md index 1eec95f..d87d64b 100644 --- a/README.md +++ b/README.md @@ -33,30 +33,39 @@ Here is how static analysis is used internally at Google: ## Enabled Lints -The currently enabled lints can be found in the sample -[analysis_options.yaml](https://github.com/dart-lang/pedantic/blob/master/lib/analysis_options.yaml). +The currently enabled lints can be found in +[analysis_options.1.7.0.yaml](https://github.com/dart-lang/pedantic/blob/master/lib/analysis_options.1.7.0.yaml). -To use those lints you can add a dependency in your `pubspec.yaml`: +## Using the Lints + +To use the lints add a dependency in your `pubspec.yaml`: ```yaml -# If you also need to import `package:pedantic/pedantic.dart`, it's a -# normal dependency. +# If you use `package:pedantic/pedantic.dart`, add a normal dependency. dependencies: - pedantic: '1.4.0' + pedantic: '1.7.0' # Or, if you just want `analysis_options.yaml`, it can be a dev dependency. dev_dependencies: - pedantic: '1.4.0' + pedantic: '1.7.0' ``` -and add an include in your `analysis_options.yaml`: +then, add an include in your `analysis_options.yaml`. If you want to always +use the latest version of the lints, add a dependency on the main +`analysis_options` file: + ```yaml include: package:pedantic/analysis_options.yaml ``` -This example uses a pinned version because every added lint rule could break a -build for projects using it. +If your continuous build and/or presubmit check lints then they will likely +fail whenever a new version of `package:pedantic` is released. To avoid this, +specify a specific version of `analysis_options.yaml` instead: + +```yaml +include: package:pedantic/analysis_options.1.7.0.yaml +``` ## Unused Lints diff --git a/lib/analysis_options.1.0.0.yaml b/lib/analysis_options.1.0.0.yaml new file mode 100644 index 0000000..b34612f --- /dev/null +++ b/lib/analysis_options.1.0.0.yaml @@ -0,0 +1,23 @@ +# Copyright (c) 2019, 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. +# +# Google internally enforced rules. See README.md for more information, +# including a list of lints that are intentionally _not_ enforced. + +linter: + rules: + - avoid_empty_else + - avoid_relative_lib_imports + - avoid_return_types_on_setters + - avoid_types_as_parameter_names + - control_flow_in_finally + - no_duplicate_case_values + - prefer_contains + - prefer_equal_for_default_values + - prefer_is_not_empty + - recursive_getters + - throw_in_finally + - unrelated_type_equality_checks + - use_rethrow_when_possible + - valid_regexps diff --git a/lib/analysis_options.1.1.0.yaml b/lib/analysis_options.1.1.0.yaml new file mode 100644 index 0000000..b34612f --- /dev/null +++ b/lib/analysis_options.1.1.0.yaml @@ -0,0 +1,23 @@ +# Copyright (c) 2019, 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. +# +# Google internally enforced rules. See README.md for more information, +# including a list of lints that are intentionally _not_ enforced. + +linter: + rules: + - avoid_empty_else + - avoid_relative_lib_imports + - avoid_return_types_on_setters + - avoid_types_as_parameter_names + - control_flow_in_finally + - no_duplicate_case_values + - prefer_contains + - prefer_equal_for_default_values + - prefer_is_not_empty + - recursive_getters + - throw_in_finally + - unrelated_type_equality_checks + - use_rethrow_when_possible + - valid_regexps diff --git a/lib/analysis_options.1.2.0.yaml b/lib/analysis_options.1.2.0.yaml new file mode 100644 index 0000000..6c3b1d8 --- /dev/null +++ b/lib/analysis_options.1.2.0.yaml @@ -0,0 +1,22 @@ +# Copyright (c) 2019, 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. +# +# Google internally enforced rules. See README.md for more information, +# including a list of lints that are intentionally _not_ enforced. + +linter: + rules: + - avoid_empty_else + - avoid_relative_lib_imports + - avoid_return_types_on_setters + - avoid_types_as_parameter_names + - no_duplicate_case_values + - prefer_contains + - prefer_equal_for_default_values + - prefer_is_not_empty + - recursive_getters + - unrelated_type_equality_checks + - use_rethrow_when_possible + - unawaited_futures + - valid_regexps diff --git a/lib/analysis_options.1.3.0.yaml b/lib/analysis_options.1.3.0.yaml new file mode 100644 index 0000000..cc05280 --- /dev/null +++ b/lib/analysis_options.1.3.0.yaml @@ -0,0 +1,23 @@ +# Copyright (c) 2019, 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. +# +# Google internally enforced rules. See README.md for more information, +# including a list of lints that are intentionally _not_ enforced. + +linter: + rules: + - avoid_empty_else + - avoid_relative_lib_imports + - avoid_return_types_on_setters + - avoid_types_as_parameter_names + - no_duplicate_case_values + - prefer_contains + - prefer_equal_for_default_values + - prefer_is_empty + - prefer_is_not_empty + - recursive_getters + - unrelated_type_equality_checks + - use_rethrow_when_possible + - unawaited_futures + - valid_regexps diff --git a/lib/analysis_options.1.4.0.yaml b/lib/analysis_options.1.4.0.yaml new file mode 100644 index 0000000..117a195 --- /dev/null +++ b/lib/analysis_options.1.4.0.yaml @@ -0,0 +1,25 @@ +# Copyright (c) 2019, 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. +# +# Google internally enforced rules. See README.md for more information, +# including a list of lints that are intentionally _not_ enforced. + +linter: + rules: + - avoid_empty_else + - avoid_init_to_null + - avoid_relative_lib_imports + - avoid_return_types_on_setters + - avoid_types_as_parameter_names + - no_duplicate_case_values + - null_closures + - prefer_contains + - prefer_equal_for_default_values + - prefer_is_empty + - prefer_is_not_empty + - recursive_getters + - unrelated_type_equality_checks + - use_rethrow_when_possible + - unawaited_futures + - valid_regexps diff --git a/lib/analysis_options.1.5.0.yaml b/lib/analysis_options.1.5.0.yaml new file mode 100644 index 0000000..5640307 --- /dev/null +++ b/lib/analysis_options.1.5.0.yaml @@ -0,0 +1,28 @@ +# Copyright (c) 2019, 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. +# +# Google internally enforced rules. See README.md for more information, +# including a list of lints that are intentionally _not_ enforced. + +linter: + rules: + - avoid_empty_else + - avoid_init_to_null + - avoid_relative_lib_imports + - avoid_return_types_on_setters + - avoid_shadowing_type_parameters + - avoid_types_as_parameter_names + - empty_constructor_bodies + - no_duplicate_case_values + - null_closures + - prefer_contains + - prefer_equal_for_default_values + - prefer_is_empty + - prefer_is_not_empty + - recursive_getters + - slash_for_doc_comments + - unawaited_futures + - unrelated_type_equality_checks + - use_rethrow_when_possible + - valid_regexps diff --git a/lib/analysis_options.1.6.0.yaml b/lib/analysis_options.1.6.0.yaml new file mode 100644 index 0000000..bc56b98 --- /dev/null +++ b/lib/analysis_options.1.6.0.yaml @@ -0,0 +1,34 @@ +# Copyright (c) 2019, 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. +# +# Google internally enforced rules. See README.md for more information, +# including a list of lints that are intentionally _not_ enforced. + +linter: + rules: + - avoid_empty_else + - avoid_init_to_null + - avoid_relative_lib_imports + - avoid_return_types_on_setters + - avoid_shadowing_type_parameters + - avoid_types_as_parameter_names + - curly_braces_in_flow_control_structures + - empty_catches + - empty_constructor_bodies + - library_names + - library_prefixes + - no_duplicate_case_values + - null_closures + - prefer_contains + - prefer_equal_for_default_values + - prefer_is_empty + - prefer_is_not_empty + - recursive_getters + - slash_for_doc_comments + - type_init_formals + - unawaited_futures + - unnecessary_null_in_if_null_operators + - unrelated_type_equality_checks + - use_rethrow_when_possible + - valid_regexps diff --git a/lib/analysis_options.1.7.0.yaml b/lib/analysis_options.1.7.0.yaml new file mode 100644 index 0000000..bc56b98 --- /dev/null +++ b/lib/analysis_options.1.7.0.yaml @@ -0,0 +1,34 @@ +# Copyright (c) 2019, 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. +# +# Google internally enforced rules. See README.md for more information, +# including a list of lints that are intentionally _not_ enforced. + +linter: + rules: + - avoid_empty_else + - avoid_init_to_null + - avoid_relative_lib_imports + - avoid_return_types_on_setters + - avoid_shadowing_type_parameters + - avoid_types_as_parameter_names + - curly_braces_in_flow_control_structures + - empty_catches + - empty_constructor_bodies + - library_names + - library_prefixes + - no_duplicate_case_values + - null_closures + - prefer_contains + - prefer_equal_for_default_values + - prefer_is_empty + - prefer_is_not_empty + - recursive_getters + - slash_for_doc_comments + - type_init_formals + - unawaited_futures + - unnecessary_null_in_if_null_operators + - unrelated_type_equality_checks + - use_rethrow_when_possible + - valid_regexps diff --git a/lib/analysis_options.yaml b/lib/analysis_options.yaml index ff8cd7c..9e6a448 100644 --- a/lib/analysis_options.yaml +++ b/lib/analysis_options.yaml @@ -4,31 +4,10 @@ # # Google internally enforced rules. See README.md for more information, # including a list of lints that are intentionally _not_ enforced. +# +# Include this file if you want to always use the latest version. If your +# continuous build and/or presubmit check lints then they will likely fail +# whenever a new version of `package:pedantic` is released. To avoid this, +# specify a specific version of `analysis_options.yaml` instead. -linter: - rules: - - avoid_empty_else - - avoid_init_to_null - - avoid_relative_lib_imports - - avoid_return_types_on_setters - - avoid_shadowing_type_parameters - - avoid_types_as_parameter_names - - curly_braces_in_flow_control_structures - - empty_catches - - empty_constructor_bodies - - library_names - - library_prefixes - - no_duplicate_case_values - - null_closures - - prefer_contains - - prefer_equal_for_default_values - - prefer_is_empty - - prefer_is_not_empty - - recursive_getters - - slash_for_doc_comments - - type_init_formals - - unawaited_futures - - unnecessary_null_in_if_null_operators - - unrelated_type_equality_checks - - use_rethrow_when_possible - - valid_regexps +include: package:pedantic/analysis_options.1.7.0.yaml diff --git a/pubspec.yaml b/pubspec.yaml index 0a23b0c..b20ee30 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: pedantic -version: 1.6.0 +version: 1.7.0 description: How to get the most value from Dart static analysis. author: Dart Team homepage: https://github.com/dart-lang/pedantic