Skip to content

Commit

Permalink
fix: Remove and fix all unnecessary ignores
Browse files Browse the repository at this point in the history
  • Loading branch information
spydon committed Dec 8, 2023
1 parent ec3d56d commit cdcb7f4
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 36 deletions.
1 change: 0 additions & 1 deletion packages/ubuntu_lints/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ include: lib/analysis_options.yaml
analyzer:
language:
strict-casts: false
strict-raw-types: false
3 changes: 1 addition & 2 deletions packages/ubuntu_lints/bin/check_duplicates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ List<String> yamlToRules(String content) {
Map<String, bool> yamlToOverrideRules(String content) {
final yaml = loadYaml(content) as YamlMap;
return (yaml['linter']['rules'] as Map).map<String, bool>(
// ignore: unnecessary_lambdas
(key, value) => MapEntry(key, value),
(key, value) => MapEntry(key as String, value as bool),
);
}

Expand Down
1 change: 0 additions & 1 deletion packages/ubuntu_logger/lib/src/ubuntu_logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ class _LogFormatter extends LogRecordFormatter {
buffer.write(record.error);
}

// ignore: avoid_as
final stackTrace = record.stackTrace ??
(record.error is Error ? (record.error as Error).stackTrace : null);
if (stackTrace != null) {
Expand Down
7 changes: 1 addition & 6 deletions packages/ubuntu_widgets/lib/src/menu_button_builder.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore_for_file: always_put_required_named_parameters_first

import 'package:collection/collection.dart';
import 'package:flutter/material.dart';
import 'package:yaru_icons/yaru_icons.dart';
Expand Down Expand Up @@ -233,10 +231,7 @@ class _MenuButtonBuilderState<T> extends State<MenuButtonBuilder<T>> {
const EdgeInsets.symmetric(horizontal: 16),
const EdgeInsets.symmetric(horizontal: 8),
const EdgeInsets.symmetric(horizontal: 4),
// TODO: Move to textScaler.scale, but what fontsize should be sent in?
// https://stackoverflow.com/questions/77494443/how-to-migrate-from-textscalefactor-to-textscalar-scale
// ignore: deprecated_member_use
MediaQuery.maybeOf(context)?.textScaleFactor ?? 1,
(MediaQuery.maybeOf(context)?.textScaler.scale(1) ?? 1) / 1,
);
}

Expand Down
4 changes: 1 addition & 3 deletions packages/ubuntu_widgets/lib/src/override_mouse_cursor.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore_for_file: always_put_required_named_parameters_first

import 'package:flutter/widgets.dart';

/// Overrides the mouse cursor for a subtree of widgets by stacking a mouse
Expand All @@ -11,9 +9,9 @@ import 'package:flutter/widgets.dart';
class OverrideMouseCursor extends StatelessWidget {
/// Creates an instance.
const OverrideMouseCursor({
super.key,
required this.child,
required this.cursor,
super.key,
});

/// The child widget.
Expand Down
7 changes: 1 addition & 6 deletions packages/ubuntu_widgets/lib/src/password_strength_label.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore_for_file: always_put_required_named_parameters_first

import 'package:flutter/material.dart';
import 'package:password_strength/password_strength.dart' as pws;
import 'package:ubuntu_localizations/ubuntu_localizations.dart';
Expand Down Expand Up @@ -37,10 +35,7 @@ PasswordStrength estimatePasswordStrength(String password) {
/// A widget that visualizes the strength of a password.
class PasswordStrengthLabel extends StatelessWidget {
/// Creates a new label with the given [strength].
const PasswordStrengthLabel({
super.key,
required this.strength,
});
const PasswordStrengthLabel({required this.strength, super.key});

/// The strength of the password.
final PasswordStrength strength;
Expand Down
26 changes: 12 additions & 14 deletions packages/ubuntu_widgets/lib/src/push_button.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore_for_file: always_put_required_named_parameters_first

import 'package:flutter/material.dart';

/// The minimum size of a push button.
Expand All @@ -12,7 +10,7 @@ abstract class PushButton extends ButtonStyleButton {
/// See also:
/// * [ElevatedButton]
const factory PushButton.elevated({
Key? key,
required Widget child,
required VoidCallback? onPressed,
VoidCallback? onLongPress,
ValueChanged<bool>? onHover,
Expand All @@ -22,15 +20,15 @@ abstract class PushButton extends ButtonStyleButton {
bool autofocus,
Clip clipBehavior,
MaterialStatesController? statesController,
required Widget child,
Key? key,
}) = _ElevatedPushButton;

/// A filled push button.
///
/// See also:
/// * [FilledButton]
const factory PushButton.filled({
Key? key,
required Widget child,
required VoidCallback? onPressed,
VoidCallback? onLongPress,
ValueChanged<bool>? onHover,
Expand All @@ -40,15 +38,15 @@ abstract class PushButton extends ButtonStyleButton {
bool autofocus,
Clip clipBehavior,
MaterialStatesController? statesController,
required Widget child,
Key? key,
}) = _FilledPushButton;

/// An outlined push button.
///
/// See also:
/// * [OutlinedButton]
const factory PushButton.outlined({
Key? key,
required Widget child,
required VoidCallback? onPressed,
VoidCallback? onLongPress,
ValueChanged<bool>? onHover,
Expand All @@ -58,13 +56,13 @@ abstract class PushButton extends ButtonStyleButton {
bool autofocus,
Clip clipBehavior,
MaterialStatesController? statesController,
required Widget child,
Key? key,
}) = _OutlinedPushButton;
}

class _ElevatedPushButton extends ElevatedButton implements PushButton {
const _ElevatedPushButton({
super.key,
required super.child,
required super.onPressed,
super.onLongPress,
super.onHover,
Expand All @@ -74,7 +72,7 @@ class _ElevatedPushButton extends ElevatedButton implements PushButton {
super.autofocus = false,
super.clipBehavior = Clip.none,
super.statesController,
required super.child,
super.key,
});

@override
Expand All @@ -92,7 +90,7 @@ class _ElevatedPushButton extends ElevatedButton implements PushButton {

class _FilledPushButton extends FilledButton implements PushButton {
const _FilledPushButton({
super.key,
required super.child,
required super.onPressed,
super.onLongPress,
super.onHover,
Expand All @@ -102,7 +100,7 @@ class _FilledPushButton extends FilledButton implements PushButton {
super.autofocus = false,
super.clipBehavior = Clip.none,
super.statesController,
required super.child,
super.key,
});

@override
Expand All @@ -120,7 +118,7 @@ class _FilledPushButton extends FilledButton implements PushButton {

class _OutlinedPushButton extends OutlinedButton implements PushButton {
const _OutlinedPushButton({
super.key,
required super.child,
required super.onPressed,
super.onLongPress,
super.onHover,
Expand All @@ -130,7 +128,7 @@ class _OutlinedPushButton extends OutlinedButton implements PushButton {
super.autofocus = false,
super.clipBehavior = Clip.none,
super.statesController,
required super.child,
super.key,
});

@override
Expand Down
4 changes: 1 addition & 3 deletions packages/ubuntu_widgets/lib/src/slide_show.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore_for_file: always_put_required_named_parameters_first

import 'dart:async';

import 'package:flutter/material.dart';
Expand All @@ -26,7 +24,6 @@ const kSlideInterval = Duration(seconds: 15);
class SlideShow extends StatefulWidget {
/// Creates a slide show with the given slides and interval.
SlideShow({
super.key,
required this.slides,
this.curve = kSlideCurve,
this.duration = kSlideDuration,
Expand All @@ -35,6 +32,7 @@ class SlideShow extends StatefulWidget {
this.autofocus = false,
this.focusNode,
this.onSlide,
super.key,
}) : assert(slides.isNotEmpty);

/// The list of slides to show.
Expand Down

0 comments on commit cdcb7f4

Please sign in to comment.