Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: lib/src/rules/package_api_docs.dart

Issue 1446383002: Bail early in API analysis if no project is set. (Closed) Base URL: https://github.com/dart-lang/linter.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library linter.src.rules.package_api_docs; 5 library linter.src.rules.package_api_docs;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:linter/src/ast.dart'; 8 import 'package:linter/src/ast.dart';
9 import 'package:linter/src/linter.dart'; 9 import 'package:linter/src/linter.dart';
10 import 'package:linter/src/project.dart'; 10 import 'package:linter/src/project.dart';
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 } 82 }
83 83
84 class Visitor extends GeneralizingAstVisitor { 84 class Visitor extends GeneralizingAstVisitor {
85 PackageApiDocs rule; 85 PackageApiDocs rule;
86 Visitor(this.rule); 86 Visitor(this.rule);
87 87
88 DartProject get project => rule.project; 88 DartProject get project => rule.project;
89 89
90 void check(Declaration node) { 90 void check(Declaration node) {
91 // If no project info is set, bail early.
92 // https://github.com/dart-lang/linter/issues/154
93 if (project == null) {
94 return;
95 }
91 if (project.isApi(node.element)) { 96 if (project.isApi(node.element)) {
92 if (node.documentationComment == null) { 97 if (node.documentationComment == null) {
93 rule.reportLint(getNodeToAnnotate(node)); 98 rule.reportLint(getNodeToAnnotate(node));
94 } 99 }
95 } 100 }
96 } 101 }
97 102
98 /// classMember ::= 103 /// classMember ::=
99 /// [ConstructorDeclaration] 104 /// [ConstructorDeclaration]
100 /// | [FieldDeclaration] 105 /// | [FieldDeclaration]
(...skipping 13 matching lines...) Expand all
114 @override 119 @override
115 visitCompilationUnitMember(CompilationUnitMember node) { 120 visitCompilationUnitMember(CompilationUnitMember node) {
116 check(node); 121 check(node);
117 } 122 }
118 123
119 @override 124 @override
120 visitNode(AstNode node) { 125 visitNode(AstNode node) {
121 // Don't visit children 126 // Don't visit children
122 } 127 }
123 } 128 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698