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

[dartdoc_test] add some ways to ignore analysis #248

Merged
merged 23 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
update CHANGELOG
  • Loading branch information
takumma committed Aug 20, 2024
commit 7af65a3979b2428520f9d0a9ff48634b55ff80c1
1 change: 1 addition & 0 deletions dartdoc_test/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
## v0.1.0
* Initial release, with code sample extraction, analysis, and some options to write or ignore analysis.
1 change: 0 additions & 1 deletion dartdoc_test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import 'package:dartdoc_test/dartdoc_test.dart';
///
/// If you want to test only specific files, you can use [exclude] options.
void main() => runDartdocTest();

```

# Ignore analysis
Expand Down
11 changes: 0 additions & 11 deletions dartdoc_test/lib/src/extractor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,3 @@ class _ForEachText extends NodeVisitor {
@override
void visitText(Text text) => _forEach(text);
}

extension on DartdocTestFile {
/// get file infomations from [ParsedUnitResult].
// ignore: unused_element
static DartdocTestFile from(ParsedUnitResult result) {
final sourceFile = SourceFile.fromString(result.content, url: result.uri);
final comments = extractDocumentationComments(result);
final imports = getImports(sourceFile, result);
return DartdocTestFile(sourceFile, imports, comments);
}
}
8 changes: 4 additions & 4 deletions dartdoc_test/lib/src/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import 'package:path/path.dart' as p;
import 'package:source_span/source_span.dart';

/// A dart file that contains documentation comments and code samples.
class DartdocTestFile {
final class DartdocTestFile {
/// Create a new [DartdocTestFile].
DartdocTestFile(this._sourceFile, this._imports, this._comments);

Expand All @@ -38,7 +38,7 @@ class DartdocTestFile {
}

/// A documentation comment extracted from a source file.
class DocumentationComment {
final class DocumentationComment {
final String _path;
final FileSpan _span;
final String _contents;
Expand Down Expand Up @@ -69,7 +69,7 @@ class DocumentationComment {
}

/// A code sample extracted from a documentation comment.
class DocumentationCodeSample {
final class DocumentationCodeSample {
/// The documentation comment that contains the code sample.
final DocumentationComment comment;

Expand Down Expand Up @@ -114,7 +114,7 @@ class DocumentationCodeSample {
}

/// A generated code sample file.
class CodeSampleFile {
final class CodeSampleFile {
/// The path of the generated file.
final String path;

Expand Down
4 changes: 3 additions & 1 deletion dartdoc_test/test/dartdoc_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ import 'package:dartdoc_test/dartdoc_test.dart';
/// and you can see the problems details.
///
/// If you want to test only specific files, you can use [exclude] option.
void main() => runDartdocTest();
void main() => runDartdocTest(
exclude: ['example/**'],
);
4 changes: 2 additions & 2 deletions dartdoc_test/test/integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ void main() {
testWithGolden('run analyze command by default', ['']);
testWithGolden('run analyze command by default with verbose flag', ['-v']);
testWithGolden('run analyze command with verbose flag', ['analyze', '-v']);
testWithGolden(
'run analyze command with exclude option', ['analyze', '-x', 'lib/**']);
testWithGolden('run analyze command with exclude option',
['analyze', '-x', 'lib/error_example.dart']);

group('extractor', () {
test('extract code samples in example directory', () async {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$ dart run dartdoc_test analyze -x lib/**
$ dart run dartdoc_test analyze -x lib/error_example.dart
Extracting code samples ...
Analyzing code samples ...
No issues found.
PASSED: No issues found! (Found 0 code samples in 0 files)
PASSED: No issues found! (Found 6 code samples in 1 files)