diff --git a/.travis.yml b/.travis.yml index 88763de4..7a99966a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ dart_task: - test: --reporter expanded xvfb: false - dartfmt - - dartanalyzer + - dartanalyzer: --fatal-warnings --fatal-infos . # Only building master means that we don't run two builds for each pull request. branches: diff --git a/analysis_options.yaml b/analysis_options.yaml index 58a1e862..e2b8e874 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,3 +1,4 @@ +include: package:pedantic/analysis_options.yaml analyzer: strong-mode: implicit-casts: false @@ -16,7 +17,8 @@ linter: - avoid_return_types_on_setters - await_only_futures - camel_case_types - - comment_references + # https://github.com/dart-lang/linter/issues/574 + #- comment_references - control_flow_in_finally - directives_ordering - empty_catches diff --git a/lib/src/block_parser.dart b/lib/src/block_parser.dart index 0a0b6781..a121927b 100644 --- a/lib/src/block_parser.dart +++ b/lib/src/block_parser.dart @@ -589,7 +589,7 @@ abstract class ListSyntax extends BlockSyntax { var childLines = []; void endItem() { - if (childLines.length > 0) { + if (childLines.isNotEmpty) { items.add(new ListItem(childLines)); childLines = []; } diff --git a/lib/src/html_renderer.dart b/lib/src/html_renderer.dart index 2429cedb..8c65a43e 100644 --- a/lib/src/html_renderer.dart +++ b/lib/src/html_renderer.dart @@ -17,7 +17,7 @@ String markdownToHtml(String markdown, ExtensionSet extensionSet, Resolver linkResolver, Resolver imageLinkResolver, - bool inlineOnly: false}) { + bool inlineOnly = false}) { var document = new Document( blockSyntaxes: blockSyntaxes, inlineSyntaxes: inlineSyntaxes, diff --git a/lib/src/inline_parser.dart b/lib/src/inline_parser.dart index 82206941..a52f42b2 100644 --- a/lib/src/inline_parser.dart +++ b/lib/src/inline_parser.dart @@ -129,7 +129,7 @@ class InlineParser { var nodes = _stack.last.children; // If the previous node is text too, just append. - if (nodes.length > 0 && nodes.last is Text) { + if (nodes.isNotEmpty && nodes.last is Text) { var textNode = nodes.last as Text; nodes[nodes.length - 1] = new Text('${textNode.text}$text'); } else { @@ -499,7 +499,7 @@ class TagSyntax extends InlineSyntax { /// [emphasis delimiters]: http://spec.commonmark.org/0.28/#can-open-emphasis final bool requiresDelimiterRun; - TagSyntax(String pattern, {String end, this.requiresDelimiterRun: false}) + TagSyntax(String pattern, {String end, this.requiresDelimiterRun = false}) : endPattern = new RegExp((end != null) ? end : pattern, multiLine: true), super(pattern); @@ -587,7 +587,7 @@ class LinkSyntax extends TagSyntax { final Resolver linkResolver; - LinkSyntax({Resolver linkResolver, String pattern: r'\['}) + LinkSyntax({Resolver linkResolver, String pattern = r'\['}) : this.linkResolver = (linkResolver ?? (String _, [String __]) => null), super(pattern, end: r'\]'); @@ -1184,7 +1184,7 @@ class TagState { parser._stack.removeLast(); // If the stack is empty now, this is the special "results" node. - if (parser._stack.length == 0) return children; + if (parser._stack.isEmpty) return children; var endMatchIndex = parser.pos; // We are still parsing, so add this to its parent's children. diff --git a/pubspec.yaml b/pubspec.yaml index feb9d45c..0944a5c2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,7 +9,7 @@ executables: markdown: environment: - sdk: '>=2.0.0-dev <3.0.0' + sdk: '>=2.0.0 <3.0.0' dependencies: args: ^1.0.0 @@ -24,5 +24,6 @@ dev_dependencies: html: '>=0.12.2 <0.14.0' js: ^0.6.1 path: ^1.3.1 + pedantic: ^1.3.0 test: ^1.2.0 yaml: ^2.1.8 diff --git a/test/util.dart b/test/util.dart index 2c874713..af846557 100644 --- a/test/util.dart +++ b/test/util.dart @@ -43,7 +43,7 @@ void validateCore(String description, String markdown, String html, Iterable inlineSyntaxes, Resolver linkResolver, Resolver imageLinkResolver, - bool inlineOnly: false}) { + bool inlineOnly = false}) { test(description, () { var result = markdownToHtml(markdown, blockSyntaxes: blockSyntaxes, diff --git a/tool/stats_lib.dart b/tool/stats_lib.dart index 53756664..5622bed7 100644 --- a/tool/stats_lib.dart +++ b/tool/stats_lib.dart @@ -80,9 +80,9 @@ class CommonMarkTestCase { enum CompareLevel { strict, loose, fail, error } CompareLevel compareResult(Config config, CommonMarkTestCase expected, - {bool throwOnError: false, - bool verboseFail: false, - bool verboseLooseMatch: false}) { + {bool throwOnError = false, + bool verboseFail = false, + bool verboseLooseMatch = false}) { String output; try { output =