Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
23 changes: 18 additions & 5 deletions .github/workflows/dart_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ jobs:

analyzer_plugin:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tools/analyzer_plugin
strategy:
fail-fast: false
matrix:
Expand All @@ -92,13 +95,23 @@ jobs:
- name: Print Dart SDK version
run: dart --version

- id: link
name: Override over_react dependency with local path
run: cd ../.. && pub get && dart tool/travis_link_plugin_deps.dart

- id: install
name: Install dependencies
run: pub get
if: always() && steps.link.outcome == 'success'

- name: Run analyzer_plugin checks
run: |
dart tool/travis_link_plugin_deps.dart
cd ./tools/analyzer_plugin
./tool/travis.sh
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I broke this up so that we could more easily conditionally run formatting step

- name: Validate dependencies
run: pub run dependency_validator --no-fatal-pins -i analyzer,build_runner,build_web_compilers,built_value_generator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi if you want to upgrade to dependency_validator v2 or v3, then it should detect the executable from build_runner and the builders from the last two, and then you'd only need to ignore analyzer which you could do statically. You'd also have to drop --no-fatal-pins and ignore whichever packages are ignored.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(probably out-of-scope since this is a small PR, just thought I'd throw it out there for future reference)

if: always() && steps.install.outcome == 'success'

- name: Verify formatting
run: pub run dart_dev format --check
if: always() && matrix.sdk == '2.7.2' && steps.install.outcome == 'success'

- name: Run tests
run: pub run dart_dev test
if: always() && steps.install.outcome == 'success'
2 changes: 1 addition & 1 deletion tools/analyzer_plugin/lib/src/assist/contributor_base.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:analyzer/analyzer.dart'; // ignore: deprecated_member_use
import 'package:analyzer/dart/analysis/session.dart';
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer_plugin/utilities/assist/assist.dart';
import 'package:meta/meta.dart';
import 'package:over_react_analyzer_plugin/src/util/analyzer_util.dart';
import 'package:over_react_analyzer_plugin/src/async_plugin_apis/assist.dart';
export 'package:over_react_analyzer_plugin/src/doc_utils/docs_meta_annotation.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class _DiagnosticGenerator {
// but it doesn't do it for plugin errors, so we need to do that here.
final lineInfo = unitResult.unit.lineInfo;
final filteredErrors =
filterIgnores(collector.errors, lineInfo, () => IgnoreInfo.calculateIgnores(unitResult.content, lineInfo));
filterIgnores(collector.errors, lineInfo, () => IgnoreInfo.forDart(unitResult.unit, unitResult.content));

return _GeneratorResult(filteredErrors, notifications);
}
Expand Down
6 changes: 3 additions & 3 deletions tools/analyzer_plugin/lib/src/diagnostic/bad_key.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,19 +158,19 @@ class BadKeyDiagnostic extends ComponentUsageDiagnosticContributor {
collector.addError(
dynamicOrObjectCode,
result.locationFor(expression),
errorMessageArgs: [type.getDisplayString(), getTypeContextString()],
errorMessageArgs: [type.getDisplayString(withNullability: false), getTypeContextString()],
);
} else if (type.isDartCoreBool || type.isDartCoreNull) {
collector.addError(
lowQualityCode,
result.locationFor(expression),
errorMessageArgs: [type.getDisplayString(), getTypeContextString()],
errorMessageArgs: [type.getDisplayString(withNullability: false), getTypeContextString()],
);
} else if (inheritsToStringImplFromObject(type?.element)) {
collector.addError(
toStringCode,
result.locationFor(expression),
errorMessageArgs: [type.getDisplayString(), getTypeContextString()],
errorMessageArgs: [type.getDisplayString(withNullability: false), getTypeContextString()],
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions tools/analyzer_plugin/lib/src/diagnostic/invalid_child.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class InvalidChildDiagnostic extends ComponentUsageDiagnosticContributor {
await collector.addErrorWithFix(
code,
location,
errorMessageArgs: [invalidType.getDisplayString(), missingBuilderMessageSuffix],
errorMessageArgs: [invalidType.getDisplayString(withNullability: false), missingBuilderMessageSuffix],
fixKind: addBuilderInvocationFix,
computeFix: () => buildFileEdit(result, (builder) {
buildMissingInvocationEdits(argument, builder);
Expand All @@ -81,7 +81,7 @@ class InvalidChildDiagnostic extends ComponentUsageDiagnosticContributor {
} else if (invalidType is FunctionType || invalidType.isDartCoreFunction) {
// Functions can be used as children
} else {
collector.addError(code, location, errorMessageArgs: [invalidType.getDisplayString()]);
collector.addError(code, location, errorMessageArgs: [invalidType.getDisplayString(withNullability: false)]);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ignore: deprecated_member_use
import 'package:analyzer/analyzer.dart' show NodeLocator;
import 'package:analyzer/dart/ast/ast.dart';
import 'package:over_react_analyzer_plugin/src/util/analyzer_util.dart';
import 'package:over_react_analyzer_plugin/src/util/react_types.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:over_react_analyzer_plugin/src/diagnostic/analyzer_debug_helper.dart';
Expand Down Expand Up @@ -110,7 +110,7 @@ class MissingCascadeParensDiagnostic extends DiagnosticContributor {
continue;
}

debug.log('${invocation.function.staticType?.getDisplayString()}');
debug.log('${invocation.function.staticType?.getDisplayString(withNullability: false)}');

if (isBadFunction && (invocation.function.staticType?.isReactElement ?? false)) {
final expr = invocation.function?.tryCast<InvocationExpression>() ??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,14 @@ class RenderReturnValueDiagnostic extends DiagnosticContributor {
await collector.addErrorWithFix(
code,
location,
errorMessageArgs: [returnType.getDisplayString(), missingBuilderMessageSuffix],
errorMessageArgs: [returnType.getDisplayString(withNullability: false), missingBuilderMessageSuffix],
fixKind: addBuilderInvocationFix,
computeFix: () => buildFileEdit(result, (builder) {
buildMissingInvocationEdits(returnExpression, builder);
}),
);
} else {
collector.addError(code, location, errorMessageArgs: [returnType.getDisplayString()]);
collector.addError(code, location, errorMessageArgs: [returnType.getDisplayString(withNullability: false)]);
}
});

Expand Down
Loading