This repository was archived by the owner on Jul 16, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +25
-29
lines changed Expand file tree Collapse file tree 7 files changed +25
-29
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## 4.2.0-dev.3
4+
5+ * Changed the supported ` analyzer ` version to ` ^2.1.0 ` .
6+
37## 4.2.0-dev.2
48
59* Changed the supported ` analyzer ` version to ` ^2.0.0 ` .
Original file line number Diff line number Diff line change @@ -97,7 +97,9 @@ class MetricsAnalyzerPlugin extends ServerPlugin {
9797 runZonedGuarded (
9898 () {
9999 dartDriver.results.listen ((analysisResult) {
100- _processResult (dartDriver, analysisResult);
100+ if (analysisResult is ResolvedUnitResult ) {
101+ _processResult (dartDriver, analysisResult);
102+ }
101103 });
102104 },
103105 (e, stackTrace) {
@@ -169,22 +171,19 @@ class MetricsAnalyzerPlugin extends ServerPlugin {
169171 ResolvedUnitResult analysisResult,
170172 ) {
171173 try {
172- final path = analysisResult.path;
173- if (analysisResult.unit != null &&
174- path != null &&
175- (driver.analysisContext? .contextRoot.isAnalyzed (path) ?? false )) {
174+ if (driver.analysisContext? .contextRoot.isAnalyzed (analysisResult.path) ??
175+ false ) {
176176 final fixes = _check (driver, analysisResult);
177177
178178 channel.sendNotification (
179179 plugin.AnalysisErrorsParams (
180- path,
180+ analysisResult. path,
181181 fixes.map ((fix) => fix.error).toList (),
182182 ).toNotification (),
183183 );
184184 } else {
185185 channel.sendNotification (
186- plugin.AnalysisErrorsParams (analysisResult.path! , [])
187- .toNotification (),
186+ plugin.AnalysisErrorsParams (analysisResult.path, []).toNotification (),
188187 );
189188 }
190189 } on Exception catch (e, stackTrace) {
Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ class LintAnalyzer {
105105 filePaths.intersection (context.contextRoot.analyzedFiles ().toSet ());
106106
107107 for (final filePath in analyzedFiles) {
108- final unit = await context.currentSession.getResolvedUnit2 (filePath);
108+ final unit = await context.currentSession.getResolvedUnit (filePath);
109109 if (unit is ResolvedUnitResult ) {
110110 final result = _runAnalysisForFile (
111111 unit,
@@ -130,19 +130,14 @@ class LintAnalyzer {
130130 String rootFolder, {
131131 String ? filePath,
132132 }) {
133- final unit = result.unit;
134- final content = result.content;
135-
136- if (unit != null &&
137- content != null &&
138- result.state == ResultState .VALID &&
133+ if (result.state == ResultState .VALID &&
139134 filePath != null &&
140135 _isSupported (result)) {
141- final ignores = Suppression (content, result.lineInfo);
136+ final ignores = Suppression (result. content, result.lineInfo);
142137 final internalResult = InternalResolvedUnitResult (
143138 filePath,
144- content,
145- unit,
139+ result. content,
140+ result. unit,
146141 result.lineInfo,
147142 );
148143 final relativePath = relative (filePath, from: rootFolder);
@@ -438,7 +433,5 @@ class LintAnalyzer {
438433 }
439434
440435 bool _isSupported (AnalysisResult result) =>
441- result.path != null &&
442- result.path! .endsWith ('.dart' ) &&
443- ! result.path! .endsWith ('.g.dart' );
436+ result.path.endsWith ('.dart' ) && ! result.path.endsWith ('.g.dart' );
444437}
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ class UnusedFilesAnalyzer {
6767 filePaths.intersection (context.contextRoot.analyzedFiles ().toSet ());
6868
6969 for (final filePath in analyzedFiles) {
70- final unit = await context.currentSession.getResolvedUnit2 (filePath);
70+ final unit = await context.currentSession.getResolvedUnit (filePath);
7171 unusedFiles.removeAll (_analyzeFile (filePath, unit));
7272 }
7373
@@ -95,7 +95,7 @@ class UnusedFilesAnalyzer {
9595 Iterable <String > _analyzeFile (String filePath, SomeResolvedUnitResult unit) {
9696 if (unit is ResolvedUnitResult ) {
9797 final visitor = UnusedFilesVisitor (filePath);
98- unit.unit? .visitChildren (visitor);
98+ unit.unit.visitChildren (visitor);
9999
100100 return visitor.paths;
101101 }
Original file line number Diff line number Diff line change 11name : dart_code_metrics
2- version : 4.2.0-dev.2
2+ version : 4.2.0-dev.3
33description : Software analytics tool that helps developers analyse and improve software quality.
44homepage : https://dartcodemetrics.dev
55repository : https://github.com/dart-code-checker/dart-code-metrics
@@ -9,7 +9,7 @@ environment:
99 sdk : " >=2.12.0 <3.0.0"
1010
1111dependencies :
12- analyzer : ^2.0 .0
12+ analyzer : ^2.1 .0
1313 analyzer_plugin : ^0.7.0
1414 ansicolor : ^2.0.1
1515 args : ^2.0.0
Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ class FileResolver {
2828
2929 return InternalResolvedUnitResult (
3030 path,
31- parseResult.content! ,
32- parseResult.unit! ,
31+ parseResult.content,
32+ parseResult.unit,
3333 parseResult.lineInfo,
3434 );
3535 }
Original file line number Diff line number Diff line change 11name : dart_code_metrics_plugin_loader
22description : This pubspec determines the version of the analyzer plugin to load.
3- version : 4.2.0-dev.2
3+ version : 4.2.0-dev.3
44
55environment :
66 sdk : " >=2.12.0 <3.0.0"
77
88dependencies :
9- dart_code_metrics : ^4.2.0-dev.2
9+ dart_code_metrics : ^4.2.0-dev.3
You can’t perform that action at this time.
0 commit comments