Skip to content
This repository has been archived by the owner on Nov 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #22 from davidmorgan/split-yamls
Browse files Browse the repository at this point in the history
Split into versioned yaml files; update README.md.
  • Loading branch information
davidmorgan authored May 9, 2019
2 parents 96ca50c + 96cf3ec commit 59e9d4a
Show file tree
Hide file tree
Showing 12 changed files with 244 additions and 38 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 23 additions & 0 deletions lib/analysis_options.1.0.0.yaml
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions lib/analysis_options.1.1.0.yaml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions lib/analysis_options.1.2.0.yaml
Original file line number Diff line number Diff line change
@@ -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
23 changes: 23 additions & 0 deletions lib/analysis_options.1.3.0.yaml
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions lib/analysis_options.1.4.0.yaml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions lib/analysis_options.1.5.0.yaml
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions lib/analysis_options.1.6.0.yaml
Original file line number Diff line number Diff line change
@@ -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
34 changes: 34 additions & 0 deletions lib/analysis_options.1.7.0.yaml
Original file line number Diff line number Diff line change
@@ -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
33 changes: 6 additions & 27 deletions lib/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
homepage: https://github.com/dart-lang/pedantic
Expand Down

0 comments on commit 59e9d4a

Please sign in to comment.