Skip to content

Commit

Permalink
feat: use lints from very_good_analysis (maplibre#434)
Browse files Browse the repository at this point in the history
This pull request swaps out the basic flutter_lints ruleset for a more
strict one, in this case the one from very_good_analysis because it gets
used often in other projects and is well maintained.
I made it that all packages reference the same lint file with the option
to change the behavior for some if needed.

- very_good_analysis has the same lower sdk bound as we, so it matches
quite well.
- I added all the lints to be ignored temporarily. Most of them are code
smells, the use of dynamic typing, undocumented code or hints where code
can be refactored to be more clean in general.
  • Loading branch information
josxha authored and remax21 committed Sep 6, 2024
1 parent a9962d9 commit 3e70cc5
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 29 deletions.
69 changes: 64 additions & 5 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,69 @@
include: package:flutter_lints/flutter.yaml
include: package:very_good_analysis/analysis_options.yaml

analyzer:
errors:
# remove once git dependencies have been removed
invalid_dependency: ignore
language:
# temporary rules
strict-casts: false
strict-raw-types: false
strict-inference: false

linter:
rules:
constant_identifier_names: false
# temporary rules
avoid_escaping_inner_quotes: false
prefer_interpolation_to_compose_strings: false
prefer_if_elements_to_conditional_expressions: false
constant_identifier_names: false
flutter_style_todos: false
one_member_abstracts: false
lines_longer_than_80_chars: false
prefer_int_literals: false
unnecessary_lambdas: false
avoid_print: false
noop_primitive_operations: false
avoid_bool_literals_in_conditional_expressions: false
avoid_unused_constructor_parameters: false
no_default_cases: false
sort_pub_dependencies: false
unnecessary_breaks: false
avoid_redundant_argument_values: false
unawaited_futures: false
overridden_fields: false
avoid_setters_without_getters: false
cast_nullable_to_non_nullable: false
only_throw_errors: false
no_runtimeType_toString: false
always_put_required_named_parameters_first: false
leading_newlines_in_multiline_strings: false
prefer_constructors_over_static_methods: false
prefer_null_aware_method_calls: false
directives_ordering: false
unnecessary_await_in_return: false
avoid_multiple_declarations_per_line: false
unnecessary_string_escapes: false
parameter_assignments: false
combinators_ordering: false
use_setters_to_change_properties: false
avoid_equals_and_hash_code_on_mutable_classes: false
type_annotate_public_apis: false
unnecessary_library_directive: false
prefer_asserts_with_message: false
public_member_api_docs: false
require_trailing_commas: false
avoid_dynamic_calls: false
avoid_void_async: false
always_use_package_imports: false
prefer_single_quotes: false
always_declare_return_types: false
sort_constructors_first: false
avoid_relative_lib_imports: false
avoid_positional_boolean_parameters: false
prefer_final_fields: false
prefer_final_locals: false
prefer_final_in_for_each: false
implicit_call_tearoffs: false
comment_references: false
cascade_invocations: false
avoid_type_to_string: false
omit_local_variable_types: false
use_named_constants: false
6 changes: 5 additions & 1 deletion example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
include: package:flutter_lints/flutter.yaml
include: ../analysis_options.yaml

linter:
rules:
public_member_api_docs: false
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:
device_info_plus: ^9.0.2

dev_dependencies:
flutter_lints: '>=3.0.0 <5.0.0'
very_good_analysis: ^5.0.0
flutter_test:
sdk: flutter

Expand Down
6 changes: 1 addition & 5 deletions maplibre_gl_platform_interface/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
include: package:flutter_lints/flutter.yaml

linter:
rules:
constant_identifier_names: false
include: ../analysis_options.yaml
2 changes: 1 addition & 1 deletion maplibre_gl_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ dependencies:
meta: ^1.0.5

dev_dependencies:
flutter_lints: '>=3.0.0 <5.0.0'
very_good_analysis: ^5.0.0
12 changes: 1 addition & 11 deletions maplibre_gl_web/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
include: package:flutter_lints/flutter.yaml

analyzer:
errors:
# remove once git dependencies have been removed
invalid_dependency: ignore

linter:
rules:
overridden_fields: false
avoid_print: false
include: ../analysis_options.yaml
2 changes: 1 addition & 1 deletion maplibre_gl_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies:
image: ^4.0.17

dev_dependencies:
flutter_lints: '>=3.0.0 <5.0.0'
very_good_analysis: ^5.0.0

platforms:
web:
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies:
maplibre_gl_web: ^0.19.0+2

dev_dependencies:
flutter_lints: '>=3.0.0 <5.0.0'
very_good_analysis: ^5.0.0

flutter:
plugin:
Expand Down
4 changes: 2 additions & 2 deletions scripts/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include: package:flutter_lints/flutter.yaml
include: ../analysis_options.yaml

linter:
rules:
avoid_print: false
avoid_print: false
2 changes: 1 addition & 1 deletion scripts/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ dependencies:
recase: ^4.0.0

dev_dependencies:
flutter_lints: '>=3.0.0 <5.0.0'
very_good_analysis: ^5.0.0

0 comments on commit 3e70cc5

Please sign in to comment.