Repository navigation
Conversation
The scanner only ran 'make flutter/android' (native libs), so pub get and code generation never happened. The Dart analyzer could not resolve any package import or generated file and reported thousands of false-positive dart:S2260 issues (e.g. "The function 'expect' isn't defined").
|
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
…and board decoder Also gives the Sonar Dart analysis new test files to resolve, to confirm on this PR that imports from flutter_test and mlperfbench no longer report dart:S2260.
|
anhappdev
marked this pull request as ready for review
October 11, 2026 08:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Problem
SonarCloud reports thousands of false-positive Dart issues (
dart:S2260), e.g.The function 'expect' isn't defined,Undefined name 'BackendInfo',Target of URI doesn't exist: 'package:collection/collection.dart'. Onmasterthere are 4,444 open ones (3,656 influtter/lib, 502 inunit_test, 206 inintegration_test, 80 intest). PRs only show the ones in files they touch, e.g. #1180 shows 51, all inbenchmark_store_test.dart.Cause
scanner/build-apponly runsmake flutter/android(native libs via bazel). It never runsflutter/prepare, so there is no.dart_tool/package_config.jsonand no generated sources (lib/protos,*.g.dart, l10n,*.gen.dart). The Dart analyzer cannot resolve any import.SonarQube Cloud documents this prerequisite: run
flutter pub getand do a full build before the analysis, otherwise results are "incomplete and potentially incorrect" (Dart docs).Change
New
scanner/prepare-darttarget (make flutter/prepare), run beforesonar-scanner. It runs outside the C++ build-wrapper, so the captured compile commands are unchanged.flutter/preparealready runs in CI without secrets (Firebase config falls back to dummy values) and in the same Android base image.Verification
Local check on
flutter/unit_test/benchmark/benchmark_store_test.dart:dart analyzemake flutter/preparemake flutter/preparemake -n scanner/scanshows the order: build-wrapper build,make flutter/prepare,sonar-scanner.Live check on this PR
Three new unit test files (31 tests, all pass locally,
import_sorter,dart formatanddart analyze --fatal-infosclean) so the Sonar Dart analysis has new files to resolve on this PR:unit_test/resources/utils_test.dart: URI helpers,filterInternetResources,jsonToStringIndented,lerpRangeunit_test/benchmark/performance_result_validity_test.dart: valid / semivalid / invalid matrix, stable diffusion ignoring early stopping, colorsunit_test/board_decoder_test.dart: loads the bundleddatabase.jsonassetExpected result: the SonarCloud report for this PR shows no
dart:S2260("isn't defined" / "Undefined name") on these files. Before the fix, the same kind of file (benchmark_store_test.dartin #1180) got 51 of them. If they still appear, the scan still can't resolve imports.Not verified / to watch
SonarScannerjob on this PR is the real test.masteranalysis may surface real Dart issues that were hidden by the noise. Existing 4,444 false positives should close on the nextmasterscan.