Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable pkg:pedantic lints #236

Merged
merged 2 commits into from
Oct 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include: package:pedantic/analysis_options.yaml
analyzer:
strong-mode:
implicit-casts: false
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/src/block_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ abstract class ListSyntax extends BlockSyntax {
var childLines = <String>[];

void endItem() {
if (childLines.length > 0) {
if (childLines.isNotEmpty) {
items.add(new ListItem(childLines));
childLines = <String>[];
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/html_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions lib/src/inline_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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'\]');

Expand Down Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion test/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void validateCore(String description, String markdown, String html,
Iterable<InlineSyntax> inlineSyntaxes,
Resolver linkResolver,
Resolver imageLinkResolver,
bool inlineOnly: false}) {
bool inlineOnly = false}) {
test(description, () {
var result = markdownToHtml(markdown,
blockSyntaxes: blockSyntaxes,
Expand Down
6 changes: 3 additions & 3 deletions tool/stats_lib.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down