Skip to content

Commit

Permalink
Merge pull request #1350 from bitmark-inc/misc/update-linter
Browse files Browse the repository at this point in the history
[github action] update lint rue and replace the lint action with revi…
  • Loading branch information
anhnguyenbitmark authored Nov 6, 2023
2 parents 847c82f + 92d555d commit 0f4abd4
Show file tree
Hide file tree
Showing 2 changed files with 155 additions and 25 deletions.
36 changes: 23 additions & 13 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,29 @@ jobs:
- name: Submoudles update
run: git -c submodule.auto-test.update=none submodule update --init --recursive
- run: flutter pub get
- name: Analyze Dart
uses: invertase/github-action-dart-analyzer@v1
- uses: reviewdog/action-setup@v1
with:
annotate: true
working-directory: ./
reviewdog_version: latest
- name: Run reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
flutter analyze --no-preamble | reviewdog -efm="%p%t%r • %m • %f:%l:%c • %s" -reporter=github-pr-review
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install codespell
run: pip install codespell
- name: Fix the code
run: |
dart format .
dart fix --apply
codespell -i 3 -w -I .codespellignore --skip "**/*.g.dart,*.svg"
- name: suggester / dart fixes
uses: reviewdog/action-suggester@v1
with:
tool_name: dart fix
cleanup: true

gitleaks:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -102,12 +120,4 @@ jobs:
pattern: |
*.dart
*.swift
*.kt
- uses: codespell-project/codespell-problem-matcher@v1
- name: codespell
uses: codespell-project/actions-codespell@v2
with:
check_filenames: true
ignore_words_file: .codespellignore
only_warn: 1
exclude_file: pubspec.yaml
*.kt
144 changes: 132 additions & 12 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,142 @@ linter:
# producing the lint.
rules:
# style rules
constant_identifier_names: false
camel_case_types: true
library_names: true
avoid_catching_errors: true
avoid_empty_else: true
unnecessary_brace_in_string_interps: true
always_declare_return_types: true
always_put_control_body_on_new_line: true
always_put_required_named_parameters_first: true
annotate_overrides: true
avoid_annotating_with_dynamic: true
avoid_escaping_inner_quotes: true
avoid_function_literals_in_foreach_calls: true
avoid_init_to_null: true
avoid_multiple_declarations_per_line: true
avoid_null_checks_in_equality_operators: true
avoid_private_typedef_functions: true
avoid_redundant_argument_values: true
leading_newlines_in_multiline_strings: true
# formatting: true
# lines_longer_than_80_chars: true
avoid_renaming_method_parameters: true
avoid_return_types_on_setters: true
avoid_returning_null_for_void: true
avoid_single_cascade_in_expression_statements: true
avoid_unnecessary_containers: true
avoid_unused_constructor_parameters: true
avoid_void_async: true
await_only_futures: true
cascade_invocations: true
cast_nullable_to_non_nullable: true
combinators_ordering: true
constant_identifier_names: true
curly_braces_in_flow_control_structures: true
# doc comments
dangling_library_doc_comments: true
directives_ordering: true
empty_catches: true
empty_constructor_bodies: true
eol_at_end_of_file: true
exhaustive_cases: true
implicit_call_tearoffs: true
leading_newlines_in_multiline_strings: true
library_annotations: true
no_leading_underscores_for_library_prefixes: true
no_leading_underscores_for_local_identifiers: true
no_literal_bool_comparisons: true
non_constant_identifier_names: true
noop_primitive_operations: true
null_check_on_nullable_type_parameter: true
null_closures: true
omit_local_variable_types: true
prefer_adjacent_string_concatenation: true
prefer_collection_literals: true
prefer_conditional_assignment: true
prefer_const_constructors: true
prefer_const_constructors_in_immutables: true
prefer_const_declarations: true
prefer_const_literals_to_create_immutables: true
prefer_contains: true
prefer_expression_function_bodies: true
prefer_final_fields: true
prefer_final_in_for_each: true
prefer_final_locals: true
prefer_final_parameters: true
prefer_for_elements_to_map_fromIterable: true
prefer_function_declarations_over_variables: true
prefer_generic_function_type_aliases: true
prefer_if_elements_to_conditional_expressions: true
prefer_if_null_operators: true
prefer_initializing_formals: true
prefer_inlined_adds: true
prefer_int_literals: true
prefer_interpolation_to_compose_strings: true
prefer_is_empty: true
prefer_is_not_empty: true
prefer_is_not_operator: true
prefer_iterable_whereType: true
prefer_null_aware_operators: true
prefer_double_quotes: true
prefer_spread_collections: true
prefer_typing_uninitialized_variables: true
require_trailing_commas: true
sized_box_for_whitespace: true
slash_for_doc_comments: true
sort_child_properties_last: true
sort_constructors_first: true
sort_unnamed_constructors_first: true
type_annotate_public_apis: true
type_init_formals: true
type_literal_in_constant_pattern: true
unawaited_futures: true
unnecessary_brace_in_string_interps: true
unnecessary_breaks: true
unnecessary_const: true
unnecessary_constructor_name: true
unnecessary_getters_setters: true
unnecessary_lambdas: true
unnecessary_late: true
unnecessary_library_directive: true
unnecessary_new: true
unnecessary_null_aware_assignments: true
unnecessary_null_checks: true
unnecessary_null_in_if_null_operators: true
unnecessary_nullable_for_final_variable_declarations: true
unnecessary_overrides: true
unnecessary_parenthesis: true
unnecessary_raw_strings: true
unnecessary_string_escapes: true
unnecessary_string_interpolations: true
unnecessary_this: true
unnecessary_to_list_in_spreads: true
unreachable_from_main: true
use_decorated_box: true
use_enums: true
use_full_hex_values_for_flutter_colors: true
use_function_type_syntax_for_parameters: true
use_raw_strings: true
use_rethrow_when_possible: true
use_string_in_part_of_directives: true
use_super_parameters: true
# formatting: true
lines_longer_than_80_chars: true
# has a quick fix
always_use_package_imports: true
avoid_empty_else: true
avoid_print: true
avoid_relative_lib_imports: true
avoid_types_as_parameter_names: true
diagnostic_describe_all_properties: true
discarded_futures: true
empty_statements: true
hash_and_equals: true
implicit_reopen: true
invalid_case_patterns: true
no_duplicate_case_values: true
prefer_void_to_null: true
use_key_in_widget_constructors: true
# recommended by don't have quick fix
unrelated_type_equality_checks: true
valid_regexps: true
control_flow_in_finally: true
collection_methods_unrelated_type: true

analyzer:
exclude:
- '**/*.g.dart'
- 'auto-test/*'
- 'test/*'
- 'auto-test/**'
- 'test/**'

0 comments on commit 0f4abd4

Please sign in to comment.