dart-code-metrics
dart-code-metrics copied to clipboard
[BUG] avoid-top-level-members-in-tests in lib
- Dart code metrics version: 4.17.0
- Dart sdk version: 2.17.6
Please show your full configuration:
Configuration
include: package:very_good_analysis/analysis_options.3.0.1.yaml
analyzer:
plugins:
- dart_code_metrics
linter:
rules:
public_member_api_docs: false
sort_constructors_first: false
dart_code_metrics:
rules-exclude:
- .dart_tool
rules:
- avoid-banned-imports
- avoid-collection-methods-with-unrelated-types
- avoid-duplicate-exports
- avoid-dynamic:
exclude:
- app_bloc_observer.dart
- avoid-global-state
- avoid-ignoring-return-values
- avoid-late-keyword:
exclude:
- test/**
- avoid-missing-enum-constant-in-map
- avoid-nested-conditional-expressions
- avoid-non-ascii-symbols
- avoid-non-null-assertion
- avoid-throw-in-catch-block
- avoid-top-level-members-in-tests
- avoid-unnecessary-type-assertions
- avoid-unnecessary-type-casts
- avoid-unrelated-type-assertions
- avoid-unused-parameters
- ban-name
- binary-expression-operand-order
- double-literal-format
- format-comment
# - member-ordering
- member-ordering-extended
- newline-before-return
- no-boolean-literal-compare
- no-empty-block
# - no-equal-arguments
- no-equal-then-else
- no-magic-number
- no-object-declaration
- prefer-async-await
- prefer-commenting-analyzer-ignores
- prefer-conditional-expressions
- prefer-correct-identifier-length
- prefer-correct-type-name
- prefer-enums-by-name
- prefer-first
- prefer-immediate-return
- prefer-last
- prefer-match-file-name:
exclude:
- l10n/**
- prefer-trailing-comma
- tag-name
- always-remove-listener
- avoid-border-all
- avoid-returning-widgets
- avoid-unnecessary-setstate
- avoid-wrapping-in-padding
- avoid-shrink-wrap-in-lists
- avoid-use-expanded-as-spacer
- prefer-const-border-radius
- prefer-correct-edge-insets-constructor
- prefer-extracting-callbacks
- prefer-single-widget-per-file:
ignore-private-widgets: true
- prefer-intl-name
- provide-correct-intl-args
What did you do? Please include the source code example causing the issue.
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:manju_ximo/consumption/consumption.dart';
import 'package:manju_ximo/l10n/l10n.dart';
class App extends StatelessWidget {
const App({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
appBarTheme: const AppBarTheme(color: Color(0xFF13B9FF)),
colorScheme: ColorScheme.fromSwatch(
accentColor: const Color(0xFF13B9FF),
),
),
localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
],
supportedLocales: AppLocalizations.supportedLocales,
home: const ConsumptionPage(),
);
}
}
What did you expect to happen?
The warning should not be there, as it is not in the test file.
What actually happened?
The warning should be there.
Are you willing to submit a pull request to fix this bug?
No, I don't have the knowledge to do that.
Finally, I submitted a pull request. 😄
@lsaudon thank you for the report and for the fix!
+1 see same problem
Looking forward to the release! This rule is completely useless without the fix :(
You can exclude the project ’/**’ in your config file to solve the problem. @fzyzcjy
@lsaudon Can I do that for this specific rule? Could you please share your config, thanks
@lsaudon Can I do that for this specific rule? Could you please share your config, thanks
Just for this rule.
Like this
dart_code_metrics:
rules:
- no-equal-arguments:
exclude:
- test/**
Thanks!
Available in 4.18.0 🚀