abide 1.6.4

  • README.md
  • Example
  • Installing
  • Versions
  • new49

Abide #

A command line tool to manage analysis_options.yaml and check if it abides by requirements. This project is meant to be a tool for both local and CI use.

What does it do? #

Running abide will check for these recommendations

  • You should have abide installed in dev_dependencies in pubspec.yaml.
  • You should have 'pub run abide' command as part of the CI run.
  • You should have an analysis_options.yaml.
  • .analysis_options should be renamed to analysis_options.yaml
  • You should have strong mode set.
  • You must have the required lints from abide.yaml.
  • You must not have avoid lint rules from abide.yaml.
  • You are encouraged to use the recommended lints.
  • Optional lints are ignored by this tool. It's up to you or your team to decide if you want to use them.

If you include the flag --json (or -j for short), it writes abide.json in the current directory with the results of analysis. This file can be used for further tooling or to report to a datastore for querying. You might consider adding abide.json to your .gitignore if it bothers you.

  • Rename .analysis_options to analysis_options.yaml
  • It WILL modify your existing analysis_options.yaml file in the current directory if it exists.
  • It will preserve any customizations you've added under analyzer -> errors.
  • It will add ALL lint rules that exist, commenting out the ones to be avoided.
  • It includes descriptions, recommendations (required, optional, avoid) and the reason for the recommendation.
  • It will add a comment with the number of lints added by that rule. This let's you prioritize which lint rules to undertake fixing.
  • It will auto-comment lint rules that
    1. have existing warnings in your code
    2. have a recommendation of recommended or optional
  • with --uncomment-clean It will auto-uncomment lint rules that
    1. have no existing warnings in your code
    2. have a recommendation of recommended or optional


    # Declare method return types.
    # recommendation: recommended
    # reason: React component render() method can return either ReactElement or false
    # FIXME: 1201 lint(s)
    # - always_declare_return_types

Running abide help outputs

Usage: abide [command]
abide [--json|-j] (default: Checks that your analysis_options.yaml abides by recommendations)
abide update [--uncomment-clean|-c] (Updates your analysis_options.yaml with default recommendations)
abide help (shows this help)

--uncomment-clean will automatically uncomment recommended or optional rules that do not have any lints
  without this option, abide will attempt to preserve the state of any commented out rules.

Installing #

As a dependency #

Add it to your pubspec.yaml under dev_dependencies:

  abide: ^1.6.0

This will allow you to pub run abide in this project directory. If you want to be able to run abide on any project without updating project dependencies, use the global install instructions below. You can install it both ways and run either the project version or the global version

  • pub run abide - Runs the local project version
  • pub global run abide - Runs the globally installed version

As a global install #

  1. To install or update to the latest version, run:
pub global activate abide
  1. It is highly recommended to add ~/.pub-cache/bin to your system PATH to be able to run abide directly.
  • Without PATH set: pub global run abide
  • With PATH set: abide (much better)

To install a local version, clone it from github and activate it from the current directory.
git clone git@github.com:Workiva/abide.git
cd abide
pub global activate --source path .

Upgrading the lints in abide.yaml #

For abide maintainers, there is an additional tool under upgrade/ to automatically upgrade the abide.yaml file with the latest lints directly from the code used in the linter package. It is a separate tool with separate dependencies to not introduce the linter and analyzer dependencies on the main abide project. It is best to get the latest lints by getting the latest version of the linter package. The absolute latest is under Dart 2 (at the time of this writing - March 2018). Maintainers should use the latest Dart 2 dev or stable release to run abide_upgrade.

To use it, just globally activate it and run it in the abide root.

cd upgrade
pub global activate --source path .
cd ..

It will regenerate the lib/abide.yaml file with all the latest lints. It will preserve any existing recommendations and reasons for existing lints and use optional for new lints. After upgrading, review the abide.yaml for changes and make any needed changes to recommendations for new lint rules.

1.6.3 #

Feb 1, 2019

  • Initial open source release. It has been in use internally at Workiva since Jun 29, 2017.


// ➜ pub global activate abide
// ➜ abide
// recommended lint rule: always_declare_return_types
// recommended lint rule: avoid_function_literals_in_foreach_calls
// recommended lint rule: avoid_init_to_null
// recommended lint rule: avoid_positional_boolean_parameters
// recommended lint rule: comment_references
// recommended lint rule: library_prefixes
// recommended lint rule: prefer_const_declarations
// recommended lint rule: prefer_initializing_formals
// recommended lint rule: prefer_single_quotes
// recommended lint rule: type_annotate_public_apis
// recommended lint rule: unawaited_futures
// recommended lint rule: unnecessary_lambdas
// recommended lint rule: unnecessary_this
//   error • (3pts) required lint rule: avoid_double_and_int_checks
//   error • (3pts) required lint rule: prefer_typing_uninitialized_variables
//   error • (3pts) required lint rule: void_checks
//   error • (12pts) pubspec.yaml does not contain Abide. Add Abide to your dev_dependencies in pubspec.yaml
//   error • (12pts) Abide is not run in CI. Add "pub run abide" command to run Abide in CI.
//   error • (8pts) Dependency Validator is not run in CI. Add "pub run dependency_validator" command to run Dependency Validator in CI.
// dart_dev@2.0.1 DOES NOT abide. 215 points out of 256 (83%)

Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate abide

2. Use it

The package has the following executables:

$ abide

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  abide: ^1.6.4

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:abide/abide.dart';
Version Uploaded Documentation Archive
1.6.4 Feb 4, 2019 Go to the documentation of abide 1.6.4 Download abide 1.6.4 archive
1.6.3 Feb 2, 2019 Go to the documentation of abide 1.6.3 Download abide 1.6.3 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13+1


Detected platforms: Flutter, other

Primary library: package:abide/abide.dart with components: io, isolate.

Health suggestions

Fix lib/src/result.dart. (-1.49 points)

Analysis of lib/src/result.dart reported 3 hints:

line 33 col 33: Use = to separate a named parameter from its default value.

line 34 col 34: Use = to separate a named parameter from its default value.

line 35 col 27: Use = to separate a named parameter from its default value.

Fix lib/src/util.dart. (-1.49 points)

Analysis of lib/src/util.dart reported 3 hints:

line 65 col 59: Use = to separate a named parameter from its default value.

line 78 col 62: Use = to separate a named parameter from its default value.

line 136 col 17: Unnecessary cast.

Fix lib/src/check.dart. (-0.50 points)

Analysis of lib/src/check.dart reported 1 hint:

line 134 col 9: The member 'alternateFileName' can only be used within 'package:abide/src/constants.dart' or a test.

Fix lib/src/update.dart. (-0.50 points)

Analysis of lib/src/update.dart reported 1 hint:

line 53 col 50: Use = to separate a named parameter from its default value.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.23.0 <3.0.0
args ^1.4.4 1.5.1
dart2_constant ^1.0.0 1.0.2+dart2
meta ^1.1.6 1.1.7
resource ^2.0.0 2.1.5
yaml ^2.1.12 2.1.15
Transitive dependencies
charcode 1.1.2
collection 1.14.11
path 1.6.2
source_span 1.5.4
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
dart_dev ^2.0.0
dependency_validator ^1.1.2
test >=0.12.34 <2.0.0