Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.0.0

- feat!: migrate to analyzer_server_plugin
- refactor: replace `avoid_unnecessary_type_casts` rule with dart analyzer's `unnecessary_cast`

## 0.3.3

- Fix pub.dev analysis issue
Expand Down
18 changes: 9 additions & 9 deletions lib/analysis_options.yaml
Comment thread
andrew-bekhiet-solid marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ analyzer:
- custom_lint
exclude:
# General generated files
- '**/*.g.dart'
- '**/*.gr.dart'
- "**/*.g.dart"
- "**/*.gr.dart"

# Flutter
- 'lib/generated_plugin_registrant.dart'
- "lib/generated_plugin_registrant.dart"

# mockito
- '*.mocks.dart'
- '**/*.mocks.dart'
- "*.mocks.dart"
- "**/*.mocks.dart"

# freezed
- '**/*.freezed.dart'
- "**/*.freezed.dart"

# protobuf
- '**/*.pb.dart'
- "**/*.pb.dart"

# test_coverage
- test/.test_coverage.dart
Expand All @@ -33,6 +33,7 @@ analyzer:
missing_required_param: error
missing_return: error
parameter_assignments: error
unnecessary_cast: warning

custom_lint:
rules:
Expand All @@ -48,7 +49,6 @@ custom_lint:
- avoid_unnecessary_return_variable
- avoid_unnecessary_setstate
- avoid_unnecessary_type_assertions
- avoid_unnecessary_type_casts
- avoid_unrelated_type_assertions
- avoid_unused_parameters
- avoid_debug_print_in_release
Expand Down Expand Up @@ -87,7 +87,7 @@ custom_lint:
- number_of_parameters:
max_parameters: 7
exclude:
- method_name: copyWith
- method_name: copyWith

- prefer_conditional_expressions:
ignore_nested: true
Expand Down
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class SolidLintsPlugin extends Plugin {
final avoidUnnecessaryTypeAssertionsRule =
AvoidUnnecessaryTypeAssertionsRule();
final doubleLiteralFormatRule = DoubleLiteralFormatRule();

final lintRules = [
AvoidFinalWithGetterRule(),
AvoidGlobalStateRule(),
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

8 changes: 4 additions & 4 deletions lib/src/utils/typecast_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import 'package:collection/collection.dart';

// TODO: consider to move here common functions for rules
// avoid_unnecessary_type_assertions
// avoid_unnecessary_type_casts (after implementation)
// avoid_unrelated_type_assertions (after implementation)

/// A class for representing arguments for types checking methods
Expand Down Expand Up @@ -66,9 +65,10 @@ class TypeCast {
return false;
}

if (this case TypeCast(source: final objectType, target: final castedType)
when objectType is ParameterizedType &&
castedType is ParameterizedType) {
if (this case TypeCast(
source: final objectType,
target: final castedType,
) when objectType is ParameterizedType && castedType is ParameterizedType) {
if (objectType.typeArguments.length != castedType.typeArguments.length) {
return false;
}
Expand Down
1 change: 0 additions & 1 deletion lint_test/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ custom_lint:
- avoid_unnecessary_setstate
- double_literal_format
- avoid_unnecessary_type_assertions
- avoid_unnecessary_type_casts
- avoid_unrelated_type_assertions
- avoid_unused_parameters:
exclude:
Expand Down
35 changes: 0 additions & 35 deletions lint_test/avoid_unnecessary_type_casts_test.dart

This file was deleted.

Loading