In script/tool/lib/src/analyze_command.dart, the method _runGradleLintForPackage runs Gradle lint analysis on the examples of a package.
Currently, it loops over the examples and fails early (returning PackageResult.fail() immediately) if configuration or linting fails for any single example:
for (final RepositoryPackage example in package.getExamples()) {
final project = GradleProject(example, processRunner: processRunner, platform: platform);
if (!project.isConfigured()) {
final bool buildSuccess = await runConfigOnlyBuild(
example,
processRunner,
platform,
FlutterPlatform.android,
);
if (!buildSuccess) {
printError('Unable to configure Gradle project.');
return PackageResult.fail(<String>['Unable to configure Gradle.']);
}
}
...
final int exitCode = await project.runCommand('$packageName:lintDebug');
if (exitCode != 0) {
return PackageResult.fail();
}
}
This is an anti-pattern for repository tooling because it prevents the developer from seeing lint failures from other examples in the same run.
Instead, it should follow the design pattern used by _runXcodeAnalysisForPackage in the same class:
- Initialize a local
errors list.
- Accumulate configuration or linting errors inside the loop.
- Return
errors.isEmpty ? PackageResult.success() : PackageResult.fail(errors) at the end of the loop.
This will improve developer velocity by providing comprehensive feedback in a single CI or local analysis run.
In
script/tool/lib/src/analyze_command.dart, the method_runGradleLintForPackageruns Gradle lint analysis on the examples of a package.Currently, it loops over the examples and fails early (returning
PackageResult.fail()immediately) if configuration or linting fails for any single example:This is an anti-pattern for repository tooling because it prevents the developer from seeing lint failures from other examples in the same run.
Instead, it should follow the design pattern used by
_runXcodeAnalysisForPackagein the same class:errorslist.errors.isEmpty ? PackageResult.success() : PackageResult.fail(errors)at the end of the loop.This will improve developer velocity by providing comprehensive feedback in a single CI or local analysis run.