From 65c0b22c53044049ce2a8d1b7c2b77baae6bb643 Mon Sep 17 00:00:00 2001 From: Vitalij Vascenko Date: Wed, 22 Jan 2025 16:15:08 +0100 Subject: [PATCH 1/2] feat: [DX-3888] Update ruleset --- .github/workflows/dcm.yml | 2 +- mews_pedantic/lib/analysis_options.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dcm.yml b/.github/workflows/dcm.yml index 80a23c40..9a19b832 100644 --- a/.github/workflows/dcm.yml +++ b/.github/workflows/dcm.yml @@ -16,7 +16,7 @@ jobs: uses: CQLabs/setup-dcm@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} - version: "1.26.1" + version: "1.26.2" - uses: ./.github/actions/setup diff --git a/mews_pedantic/lib/analysis_options.yaml b/mews_pedantic/lib/analysis_options.yaml index a6faa658..7d15165b 100644 --- a/mews_pedantic/lib/analysis_options.yaml +++ b/mews_pedantic/lib/analysis_options.yaml @@ -459,7 +459,7 @@ dart_code_metrics: # - prefer-assigning-await-expressions # - prefer-async-await - prefer-boolean-prefixes: - prefixes: [ is, are, was, were, has, have, had, can, should, will, do, does, did, allow, show, use, hide, only, enable ] + prefixes: [ is, are, was, were, has, have, had, can, should, will, do, does, did, allow, show, use, hide, only, enable, contains ] - prefer-both-inlining-annotations # - prefer-bytes-builder # - prefer-class-destructuring @@ -515,7 +515,7 @@ dart_code_metrics: # - prefer-single-declaration-per-file - prefer-specific-cases-first # - prefer-static-class - # - prefer-static-method + - prefer-static-method - prefer-switch-expression - prefer-switch-with-enums - prefer-switch-with-sealed-classes From 0ac64a2f32b419443a883910df5572a6f2951088 Mon Sep 17 00:00:00 2001 From: Vitalij Vascenko Date: Sat, 1 Feb 2025 17:42:34 +0100 Subject: [PATCH 2/2] refactor: Fix linter issues --- optimus/lib/src/chat/chat.dart | 2 ++ optimus/lib/src/feedback/alert.dart | 1 + optimus/lib/src/form/date_formatter.dart | 1 + optimus/lib/src/form/date_input_field.dart | 2 ++ optimus/lib/src/icon_list.dart | 1 + optimus/lib/src/radio/radio_circle.dart | 1 + optimus/lib/src/tabs.dart | 1 + 7 files changed, 9 insertions(+) diff --git a/optimus/lib/src/chat/chat.dart b/optimus/lib/src/chat/chat.dart index 555dabff..3fd263da 100644 --- a/optimus/lib/src/chat/chat.dart +++ b/optimus/lib/src/chat/chat.dart @@ -104,10 +104,12 @@ class OptimusChat extends StatelessWidget { nextMessageTime.difference(_currentMessageTime(index)).inDays > 1; } + // ignore: prefer-static-method, ignore until private methods could be ignored in the DCM rule bool _isLatestMessage(int index) => index == 0; bool _isOldestMessage(int index) => index + 1 == _messages.length; + // ignore: prefer-static-method, ignore until private methods could be ignored in the DCM rule int _byTime(OptimusMessage m1, OptimusMessage m2) => m2.time.compareTo(m1.time); diff --git a/optimus/lib/src/feedback/alert.dart b/optimus/lib/src/feedback/alert.dart index 4b91c784..ea8f419f 100644 --- a/optimus/lib/src/feedback/alert.dart +++ b/optimus/lib/src/feedback/alert.dart @@ -49,6 +49,7 @@ class OptimusAlert extends StatelessWidget { bool get _isExpanded => description != null || link != null; + // ignore: prefer-static-method, ignore until private methods could be ignored in the DCM rule double _getPadding(BuildContext context) => switch (MediaQuery.sizeOf(context).screenBreakpoint) { Breakpoint.small || Breakpoint.extraSmall => context.tokens.spacing100, diff --git a/optimus/lib/src/form/date_formatter.dart b/optimus/lib/src/form/date_formatter.dart index 97378edb..88eda5c4 100644 --- a/optimus/lib/src/form/date_formatter.dart +++ b/optimus/lib/src/form/date_formatter.dart @@ -47,6 +47,7 @@ class DateFormatter extends TextInputFormatter { return index; } + // ignore: prefer-static-method, ignore until private methods could be ignored in the DCM rule String _replaceCharAt(String value, int index, String replacement) => value.substring(0, index) + replacement + diff --git a/optimus/lib/src/form/date_input_field.dart b/optimus/lib/src/form/date_input_field.dart index 74d5f0e7..b20e92cc 100644 --- a/optimus/lib/src/form/date_input_field.dart +++ b/optimus/lib/src/form/date_input_field.dart @@ -120,6 +120,7 @@ class _OptimusDateInputFieldState extends State _previousValue = _controller.text; } + // ignore: prefer-static-method, ignore until private methods could be ignored in the DCM rule DateTime? _getDateTime(DateFormat format, String value) { if (value.isEmpty) return null; @@ -157,6 +158,7 @@ class _OptimusDateInputFieldState extends State } } + // ignore: prefer-static-method, ignore until private methods could be ignored in the DCM rule String _replaceSupported( String? value, _SymbolConverter input, diff --git a/optimus/lib/src/icon_list.dart b/optimus/lib/src/icon_list.dart index 8b415060..0145dd17 100644 --- a/optimus/lib/src/icon_list.dart +++ b/optimus/lib/src/icon_list.dart @@ -37,6 +37,7 @@ class OptimusIconList extends StatelessWidget { ); } + // ignore: prefer-static-method, ignore until private methods could be ignored in the DCM rule OptimusIconListSize _getListSize(BuildContext context) => switch (MediaQuery.sizeOf(context).screenBreakpoint) { Breakpoint.extraSmall || Breakpoint.small => OptimusIconListSize.small, diff --git a/optimus/lib/src/radio/radio_circle.dart b/optimus/lib/src/radio/radio_circle.dart index 7045de71..945db5ae 100644 --- a/optimus/lib/src/radio/radio_circle.dart +++ b/optimus/lib/src/radio/radio_circle.dart @@ -27,6 +27,7 @@ class RadioCircle extends StatelessWidget { : tokens.borderInteractiveSecondaryDefault, }); + // ignore: prefer-static-method, ignore until private methods could be ignored in the DCM rule WidgetStateColor _getFillColor(OptimusTokens tokens) => WidgetStateColor.fromMap({ WidgetState.disabled: tokens.backgroundInteractiveNeutralSubtleDefault, diff --git a/optimus/lib/src/tabs.dart b/optimus/lib/src/tabs.dart index da0134b1..8603e32f 100644 --- a/optimus/lib/src/tabs.dart +++ b/optimus/lib/src/tabs.dart @@ -78,6 +78,7 @@ class OptimusTabBar extends StatelessWidget { final List pages; final TabController? tabController; + // ignore: prefer-static-method, ignore until private methods could be ignored in the DCM rule Decoration _buildIndicator(OptimusTokens tokens) => UnderlineTabIndicator( borderSide: BorderSide( color: tokens.borderInteractivePrimaryDefault,