Enforce more strict analysis (#266)
Enforce more strict analysis
diff --git a/.travis.yml b/.travis.yml
index 3b6356e..6bb8e4d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,7 +1,7 @@
language: dart
dart:
- - 2.0.0
+ - 2.1.1
- dev
dart_task:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index eb10232..90a48f1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,11 @@
+## 2.1.2-dev
+
+* Dropping support for Dart 2.0.0 through 2.1.0.
+
## 2.1.1
-* Fix for encoding HTML for text string that contains `<pre>` ([#263](https://github.com/dart-lang/markdown/issues/263)).
+* Fix for encoding HTML for text string that contains `<pre>`
+ ([#263](https://github.com/dart-lang/markdown/issues/263)).
## 2.1.0
diff --git a/analysis_options.yaml b/analysis_options.yaml
index f246f8c..5ca0a04 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,5 +1,8 @@
include: package:pedantic/analysis_options.yaml
analyzer:
+ language:
+ strict-inference: true
+ strict-raw-types: true
strong-mode:
implicit-casts: false
errors:
@@ -8,27 +11,22 @@
unused_element: error
unused_import: error
unused_local_variable: error
+ # TODO(srawlins): Re-enable this once "unused" parameters are exempted.
+ inference_failure_on_untyped_parameter: ignore
linter:
rules:
#- annotate_overrides
- - avoid_empty_else
- - avoid_init_to_null
- avoid_null_checks_in_equality_operators
- - avoid_return_types_on_setters
- await_only_futures
- camel_case_types
# https://github.com/dart-lang/linter/issues/574
#- comment_references
- control_flow_in_finally
- directives_ordering
- - empty_catches
- - empty_constructor_bodies
- empty_statements
- hash_and_equals
- implementation_imports
- iterable_contains_unrelated_type
- - library_names
- - library_prefixes
- list_remove_unrelated_type
- non_constant_identifier_names
- omit_local_variable_types
@@ -37,14 +35,7 @@
- package_api_docs
- prefer_final_fields
- prefer_generic_function_type_aliases
- - prefer_is_not_empty
#- prefer_single_quotes
- - slash_for_doc_comments
- test_types_in_equals
- throw_in_finally
- - type_init_formals
- unnecessary_brace_in_string_interps
- - unnecessary_const
- - unnecessary_new
- - unrelated_type_equality_checks
- - valid_regexps
diff --git a/benchmark/benchmark.dart b/benchmark/benchmark.dart
index b6d480c..3090799 100644
--- a/benchmark/benchmark.dart
+++ b/benchmark/benchmark.dart
@@ -23,7 +23,7 @@
var start = DateTime.now();
// For a single benchmark, convert the source multiple times.
- var result;
+ String result;
for (var j = 0; j < runsPerTrial; j++) {
result = markdownToHtml(source);
}
diff --git a/bin/markdown.dart b/bin/markdown.dart
index 951b106..ce6fb82 100644
--- a/bin/markdown.dart
+++ b/bin/markdown.dart
@@ -11,7 +11,7 @@
'GitHubWeb': ExtensionSet.gitHubWeb,
};
-Future main(List<String> args) async {
+Future<void> main(List<String> args) async {
var parser = ArgParser()
..addFlag('help', negatable: false, help: 'Print help text and exit')
..addFlag('version', negatable: false, help: 'Print version and exit')
diff --git a/lib/src/version.dart b/lib/src/version.dart
index 3ace286..7a59bfe 100644
--- a/lib/src/version.dart
+++ b/lib/src/version.dart
@@ -1,2 +1,2 @@
// Generated code. Do not modify.
-const packageVersion = '2.1.1';
+const packageVersion = '2.1.2-dev';
diff --git a/pubspec.yaml b/pubspec.yaml
index 6e4602e..396387a 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: markdown
-version: 2.1.1
+version: 2.1.2-dev
description: A library for converting markdown to HTML.
author: Dart Team <misc@dartlang.org>
@@ -9,7 +9,7 @@
markdown:
environment:
- sdk: '>=2.0.0 <3.0.0'
+ sdk: '>=2.1.1 <3.0.0'
dependencies:
args: ^1.0.0
@@ -25,6 +25,6 @@
io: ^0.3.2+1
js: ^0.6.1
path: ^1.3.1
- pedantic: ^1.3.0
+ pedantic: ^1.8.0
test: ^1.2.0
yaml: ^2.1.8
diff --git a/tool/stats.dart b/tool/stats.dart
index 3581579..55ba001 100644
--- a/tool/stats.dart
+++ b/tool/stats.dart
@@ -13,7 +13,7 @@
final _configs =
List<Config>.unmodifiable([Config.commonMarkConfig, Config.gfmConfig]);
-Future main(List<String> args) async {
+Future<void> main(List<String> args) async {
final parser = ArgParser()
..addOption('section',
help: 'Restrict tests to one section, provided after the option.')
@@ -150,7 +150,7 @@
}
}
-Object _convert(obj) {
+Object _convert(Object obj) {
if (obj is CompareLevel) {
switch (obj) {
case CompareLevel.strict:
@@ -166,7 +166,7 @@
}
}
if (obj is Map) {
- var map = {};
+ var map = <String, Object>{};
obj.forEach((k, v) {
var newKey = k.toString();
map[newKey] = v;
@@ -176,7 +176,8 @@
return obj;
}
-Future _printRaw(String testPrefix, Map scores, bool updateFiles) async {
+Future<void> _printRaw(String testPrefix,
+ Map<String, Map<int, CompareLevel>> scores, bool updateFiles) async {
IOSink sink;
if (updateFiles) {
var file = getStatsFile(testPrefix);
@@ -204,7 +205,7 @@
'of ${total.toString().padLeft(4)} '
'– ${(100 * value / total).toStringAsFixed(1).padLeft(5)}% $section';
-Future _printFriendly(
+Future<void> _printFriendly(
String testPrefix,
SplayTreeMap<String, SplayTreeMap<int, CompareLevel>> scores,
bool updateFiles) async {