[go: nahoru, domu]

Skip to content

Commit

Permalink
Enable avoid_redundant_argument_values lint (flutter#91409) (flutter#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Hixie committed Oct 8, 2021
1 parent ac88d4b commit 61a0add
Show file tree
Hide file tree
Showing 667 changed files with 1,694 additions and 3,386 deletions.
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ linter:
# - avoid_positional_boolean_parameters # would have been nice to enable this but by now there's too many places that break it
- avoid_print
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
# - avoid_redundant_argument_values # not yet tested
- avoid_redundant_argument_values
- avoid_relative_lib_imports
- avoid_renaming_method_parameters
- avoid_return_types_on_setters
Expand Down
2 changes: 0 additions & 2 deletions dev/benchmarks/complex_layout/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ class UserHeader extends StatelessWidget {
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
RichText(text: TextSpan(
Expand Down Expand Up @@ -569,7 +568,6 @@ class BottomBar extends StatelessWidget {
border: Border(
top: BorderSide(
color: Theme.of(context).dividerColor,
width: 1.0,
),
),
),
Expand Down
1 change: 0 additions & 1 deletion dev/benchmarks/complex_layout/test_memory/scroll_perf.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Future<void> main() async {
},
behavior: HitTestBehavior.opaque,
child: const IgnorePointer(
ignoring: true,
child: ComplexLayoutApp(),
),
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ class _ShadowWidget extends StatelessWidget {
),
size: Size(width, height),
isComplex: true,
willChange: false,
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ class _FilteredChildAnimationPageState extends State<FilteredChildAnimationPage>
color: Colors.green,
boxShadow: complex ? <BoxShadow>[
const BoxShadow(
color: Colors.black,
blurRadius: 10.0,
),
] : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class _MultiWidgetConstructTableState extends State<MultiWidgetConstructTable>
_controller = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 10000),
lowerBound: 0,
upperBound: colorList.length + 1.0,
)..repeat();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class _CustomPainter extends CustomPainter {

_textPainter.text = span;

_textPainter.layout(minWidth: 0, maxWidth: width);
_textPainter.layout(maxWidth: width);
_linePainter.style = PaintingStyle.fill;
canvas.drawRect(
Rect.fromLTWH(xPosition, yPosition - viewPadding, width, height),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1833,7 +1833,7 @@ void pathOps78() {

void pathOps79() {
final Path path79 = Path();
path79.addRRect(RRect.fromRectAndCorners(const Rect.fromLTRB(0, 0, 64, 56), topLeft: Radius.zero, topRight: Radius.zero, bottomLeft: const Radius.circular(10), bottomRight: Radius.zero, ));
path79.addRRect(RRect.fromRectAndCorners(const Rect.fromLTRB(0, 0, 64, 56), bottomLeft: const Radius.circular(10), ));
gFillType = path79.fillType;
path80 = path79.shift(const Offset(906, 136));
gFillType = path79.fillType;
Expand Down Expand Up @@ -5828,7 +5828,7 @@ void pathOps576() {
path576.moveTo(0, 0);
path576.lineTo(220.60000000000002, 0);
path576.quadraticBezierTo(235.60000000000002, 0, 237.569696969697, 7.817946907441011);
path576.arcToPoint(const Offset(299.630303030303, 7.817946907441011), radius: const Radius.circular(32), rotation: 0, largeArc: false, clockwise: false);
path576.arcToPoint(const Offset(299.630303030303, 7.817946907441011), radius: const Radius.circular(32), clockwise: false);
path576.quadraticBezierTo(301.6, 0, 316.6, 0);
path576.lineTo(312.6, 0);
path576.lineTo(312.6, 48);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,20 @@ class BenchSimpleLazyTextScroll extends WidgetRecorder {
child: Row(
children: const <Widget>[
Flexible(
flex: 1,
child: _TestScrollingWidget(
initialScrollOffset: 0,
scrollDistance: 300,
scrollDuration: Duration(seconds: 1),
),
),
Flexible(
flex: 1,
child: _TestScrollingWidget(
initialScrollOffset: 1000,
scrollDistance: 500,
scrollDuration: Duration(milliseconds: 1500),
),
),
Flexible(
flex: 1,
child: _TestScrollingWidget(
initialScrollOffset: 2000,
scrollDistance: 700,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ class ColorItem extends StatelessWidget {
bottom: false,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text('$_counter:$prefix$index'),
Text(colorString()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ class ProductOption extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 11, vertical: 5),
decoration: BoxDecoration(
border: Border.all(
width: 1,
color: const Color(0xffebebeb),
),
borderRadius: const BorderRadius.all(Radius.circular(15)),
Expand Down
2 changes: 1 addition & 1 deletion dev/benchmarks/macrobenchmarks/lib/web_benchmarks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import 'src/web/recorder.dart';

typedef RecorderFactory = Recorder Function();

const bool isCanvasKit = bool.fromEnvironment('FLUTTER_WEB_USE_SKIA', defaultValue: false);
const bool isCanvasKit = bool.fromEnvironment('FLUTTER_WEB_USE_SKIA');

/// List of all benchmarks that run in the devicelab.
///
Expand Down
2 changes: 0 additions & 2 deletions dev/benchmarks/macrobenchmarks/test/frame_policy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ void main() {
final List<PointerEventRecord> records = <PointerEventRecord>[
PointerEventRecord(Duration.zero, <PointerEvent>[
PointerAddedEvent(
timeStamp: Duration.zero,
position: location,
),
PointerDownEvent(
timeStamp: Duration.zero,
position: location,
pointer: 1,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,16 @@ void main() {
}

runAddListenerBenchmark(_kNumWarmUp, addResult: false);
runAddListenerBenchmark(_kNumIterations, addResult: true);
runAddListenerBenchmark(_kNumIterations);

runNotifyListenerBenchmark(_kNumWarmUp, addResult: false);
runNotifyListenerBenchmark(_kNumIterations, addResult: true);
runNotifyListenerBenchmark(_kNumIterations);

runRemoveListenerBenchmark(_kNumWarmUp, addResult: false);
runRemoveListenerBenchmark(_kNumIterations, addResult: true);
runRemoveListenerBenchmark(_kNumIterations);

runRemoveListenerWhileNotifyingBenchmark(_kNumWarmUp, addResult: false);
runRemoveListenerWhileNotifyingBenchmark(_kNumIterations, addResult: true);
runRemoveListenerWhileNotifyingBenchmark(_kNumIterations);

printer.printToStdout();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void main() {
Offset(0.70, 0.04),
Offset(0.78, 0.98),
Offset(0.88, -0.00),
], tension: 0.00);
]);
_testCurve(
catmullRomCurve,
name: 'catmullrom_transform_iteration',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void main() {
for (int i = 0; i < words.length; i++) {
if (i.isEven) {
data.add(
InlineSpanSemanticsInformation(words[i], isPlaceholder: false),
InlineSpanSemanticsInformation(words[i]),
);
} else if (i.isEven) {
data.add(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class AndroidPlatformView extends StatelessWidget {
id: params.id,
viewType: viewType,
layoutDirection: TextDirection.ltr,
creationParams: null,
creationParamsCodec: const StandardMessageCodec(),
)
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
Expand Down
8 changes: 1 addition & 7 deletions dev/bots/analyze_sample_code.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ Future<void> main(List<String> arguments) async {
final ArgParser argParser = ArgParser();
argParser.addOption(
'temp',
defaultsTo: null,
help: 'A location where temporary files may be written. Defaults to a '
'directory in the system temp folder. If specified, will not be '
'automatically removed at the end of execution.',
);
argParser.addFlag(
'verbose',
defaultsTo: false,
negatable: false,
help: 'Print verbose output for the analysis process.',
);
Expand All @@ -52,12 +50,10 @@ Future<void> main(List<String> arguments) async {
argParser.addFlag(
'include-dart-ui',
defaultsTo: true,
negatable: true,
help: 'Includes the dart:ui code supplied by the engine in the analysis.',
);
argParser.addFlag(
'help',
defaultsTo: false,
negatable: false,
help: 'Print help for this command.',
);
Expand All @@ -69,7 +65,6 @@ Future<void> main(List<String> arguments) async {
argParser.addFlag(
'global-activate-snippets',
defaultsTo: true,
negatable: true,
help: 'Whether or not to "pub global activate" the snippets package. If set, will '
'activate version $_snippetsActivateVersion',
);
Expand Down Expand Up @@ -476,7 +471,6 @@ class SampleChecker {
if (!Platform.environment.containsKey('FLUTTER_ROOT')) 'FLUTTER_ROOT': _flutterRoot,
if (_flutterVersion!.isNotEmpty) 'FLUTTER_VERSION': _flutterVersion!,
},
includeParentEnvironment: true,
);
}

Expand Down Expand Up @@ -1155,7 +1149,7 @@ class Sample {
final StringBuffer buf = StringBuffer('sample ${args.join(' ')}\n');
int count = start.line;
for (final String line in input) {
buf.writeln(' ${count.toString().padLeft(4, ' ')}: $line');
buf.writeln(' ${count.toString().padLeft(4)}: $line');
count++;
}
return buf.toString();
Expand Down
2 changes: 0 additions & 2 deletions dev/bots/browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ class AppServer {
debugPort: browserDebugPort,
url: appUrl,
userDataDirectory: userDataDirectory.path,
windowHeight: 1024,
windowWidth: 1024,
), onError: chromeErrorCompleter.complete);
return AppServer._(server, chrome, chromeErrorCompleter.future);
}
Expand Down
9 changes: 0 additions & 9 deletions dev/bots/prepare_package.dart
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,6 @@ class ArchivePublisher {
try {
await _runGsUtil(
<String>['stat', cloudPath],
failOk: false,
);
} on PreparePackageException {
// `gsutil stat gs://path/to/file` will exit with 1 if file does not exist
Expand Down Expand Up @@ -737,53 +736,45 @@ Future<void> main(List<String> rawArguments) async {
final ArgParser argParser = ArgParser();
argParser.addOption(
'temp_dir',
defaultsTo: null,
help: 'A location where temporary files may be written. Defaults to a '
'directory in the system temp folder. Will write a few GiB of data, '
'so it should have sufficient free space. If a temp_dir is not '
'specified, then the default temp_dir will be created, used, and '
'removed automatically.',
);
argParser.addOption('revision',
defaultsTo: null,
help: 'The Flutter git repo revision to build the '
'archive with. Must be the full 40-character hash. Required.');
argParser.addOption(
'branch',
defaultsTo: null,
allowed: Branch.values.map<String>((Branch branch) => getBranchName(branch)),
help: 'The Flutter branch to build the archive with. Required.',
);
argParser.addOption(
'output',
defaultsTo: null,
help: 'The path to the directory where the output archive should be '
'written. If --output is not specified, the archive will be written to '
"the current directory. If the output directory doesn't exist, it, and "
'the path to it, will be created.',
);
argParser.addFlag(
'publish',
defaultsTo: false,
help: 'If set, will publish the archive to Google Cloud Storage upon '
'successful creation of the archive. Will publish under this '
'directory: $baseUrl$releaseFolder',
);
argParser.addFlag(
'force',
abbr: 'f',
defaultsTo: false,
help: 'Overwrite a previously uploaded package.',
);
argParser.addFlag(
'dry_run',
defaultsTo: false,
negatable: false,
help: 'Prints gsutil commands instead of executing them.',
);
argParser.addFlag(
'help',
defaultsTo: false,
negatable: false,
help: 'Print help for this command.',
);
Expand Down
4 changes: 2 additions & 2 deletions dev/bots/test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ Future<void> _runFrameworkTests() async {

Future<void> runLibraries() async {
final List<String> tests = Directory(path.join(flutterRoot, 'packages', 'flutter', 'test'))
.listSync(followLinks: false, recursive: false)
.listSync(followLinks: false)
.whereType<Directory>()
.where((Directory dir) => dir.path.endsWith('widgets') == false)
.map<String>((Directory dir) => path.join('test', path.basename(dir.path)) + path.separator)
Expand Down Expand Up @@ -1215,7 +1215,7 @@ Future<void> _ensureChromeDriverIsRunning() async {
final Uri chromeDriverUrl = Uri.parse('http://localhost:4444/status');
final HttpClientRequest request = await client.getUrl(chromeDriverUrl);
final HttpClientResponse response = await request.close();
final Map<String, dynamic> webDriverStatus = json.decode(await response.transform(utf8.decoder).join('')) as Map<String, dynamic>;
final Map<String, dynamic> webDriverStatus = json.decode(await response.transform(utf8.decoder).join()) as Map<String, dynamic>;
client.close();
final bool webDriverReady = (webDriverStatus['value'] as Map<String, dynamic>)['ready'] as bool;
if (!webDriverReady) {
Expand Down
2 changes: 1 addition & 1 deletion dev/bots/test/analyze_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,6 @@ void main() {
const Hash256(0xA8100AE6AA1940D0, 0xB663BB31CD466142, 0xEBBDBD5187131B92, 0xD93818987832EB89), // sha256("\xff")
const Hash256(0x155644D3F13D98BF, 0, 0, 0),
},
), exitCode: 0);
));
});
}
3 changes: 1 addition & 2 deletions dev/bots/test/prepare_package_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ void main() {
tempDir,
testRef,
Branch.dev,
strict: true,
processManager: processManager,
subprocessOutput: false,
platform: platform,
Expand Down Expand Up @@ -495,7 +494,7 @@ void main() {
'$gsutilCall -- stat $gsArchivePath': <ProcessResult>[ProcessResult(0, 0, '', '')],
};
processManager.addCommands(convertResults(calls));
expect(() async => publisher.publishArchive(false), throwsException);
expect(() async => publisher.publishArchive(), throwsException);
});

test('publishArchive does not throw if forceUpload is true and artifact already exists on cloud storage', () async {
Expand Down
3 changes: 0 additions & 3 deletions dev/bots/unpublish_package.dart
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@ Future<void> main(List<String> rawArguments) async {
final ArgParser argParser = ArgParser();
argParser.addOption(
'temp_dir',
defaultsTo: null,
help: 'A location where temporary files may be written. Defaults to a '
'directory in the system temp folder. If a temp_dir is not '
'specified, then by default a generated temporary directory will be '
Expand Down Expand Up @@ -431,7 +430,6 @@ Future<void> main(List<String> rawArguments) async {
);
argParser.addFlag(
'confirm',
defaultsTo: false,
help: 'If set, will actually remove the archive from Google Cloud Storage '
'upon successful execution of this script. Published archives will be '
'removed from this directory: $baseUrl$releaseFolder. This option '
Expand All @@ -440,7 +438,6 @@ Future<void> main(List<String> rawArguments) async {
);
argParser.addFlag(
'help',
defaultsTo: false,
negatable: false,
help: 'Print help for this command.',
);
Expand Down
1 change: 0 additions & 1 deletion dev/conductor/core/lib/src/repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,6 @@ class FrameworkRepository extends Repository {
name: RemoteName.upstream,
url: 'file://$upstreamPath/',
),
localUpstream: false,
previousCheckoutLocation: previousCheckoutLocation,
);
}
Expand Down
1 change: 0 additions & 1 deletion dev/conductor/core/lib/src/roll_dev.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class RollDevCommand extends Command<void> {
kCandidateBranch,
help: 'Specifies which git branch to roll to the dev branch. Required.',
valueHelp: 'branch',
defaultsTo: null, // This option is required
);
argParser.addFlag(
kForce,
Expand Down
Loading

0 comments on commit 61a0add

Please sign in to comment.