diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..7a2b6e2 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,3 @@ +## 1.0.1 + +- Initial release diff --git a/README.md b/README.md index 0c3759b..03312f1 100644 --- a/README.md +++ b/README.md @@ -111,18 +111,25 @@ An automated tool will be integrated into a CI check to verify that Workiva Dart projects depend on this package at a specific version (or later) and include the shared config in `analysis_options.yaml`. -## Ensuring that analyzer errors/warnings/lints get fixed +## Ensuring that analyzer infractions get fixed -All required analyzer lints and rules will have their severities upgraded to -"error" so that they cause analysis to fail by default. +All required analyzer lints and infos/hints/lints will have their severities +upgraded to "warning", e.g.: ```yaml # package:workiva_analysis_options/v1.yaml analyzer: errors: - avoid_empty_else: error + avoid_empty_else: warning ``` +It is then expected (and enforced internally at Workiva) that CI and developers +run analysis in a way that results in a non-zero exit code when errors or +warnings are present. + +With `dartanalyzer`, this means using `--fatal-warnings`. With `tuneup`, this is +enforced by default. + --- ## Latest Analysis Options Designations diff --git a/lib/v1.optional.yaml b/lib/v1.optional.yaml index 7b66a9e..8c306eb 100644 --- a/lib/v1.optional.yaml +++ b/lib/v1.optional.yaml @@ -70,40 +70,40 @@ include: package:workiva_analysis_options/v1.recommended.yaml analyzer: errors: # Promote enabled lints to errors: - always_declare_return_types: error - always_put_required_named_parameters_first: error - always_specify_types: error - avoid_as: error - avoid_catches_without_on_clauses: error - avoid_classes_with_only_static_members: error - avoid_equals_and_hash_code_on_mutable_classes: error - avoid_js_rounded_ints: error - avoid_print: error - constant_identifier_names: error - control_flow_in_finally: error - directives_ordering: error - flutter_style_todos: error - invariant_booleans: error - literal_only_boolean_expressions: error - non_constant_identifier_names: error - parameter_assignments: error - prefer_asserts_with_message: error - prefer_const_constructors: error - prefer_const_constructors_in_immutables: error - prefer_const_literals_to_create_immutables: error - prefer_expression_function_bodies: error - prefer_for_elements_to_map_fromIterable: error - prefer_foreach: error - prefer_int_literals: error - prefer_relative_imports: error - prefer_typing_uninitialized_variables: error - public_member_api_docs: error - sort_child_properties_last: error - sort_unnamed_constructors_first: error - throw_in_finally: error - use_setters_to_change_properties: error - use_string_buffers: error - use_to_and_as_if_applicable: error + always_declare_return_types: warning + always_put_required_named_parameters_first: warning + always_specify_types: warning + avoid_as: warning + avoid_catches_without_on_clauses: warning + avoid_classes_with_only_static_members: warning + avoid_equals_and_hash_code_on_mutable_classes: warning + avoid_js_rounded_ints: warning + avoid_print: warning + constant_identifier_names: warning + control_flow_in_finally: warning + directives_ordering: warning + flutter_style_todos: warning + invariant_booleans: warning + literal_only_boolean_expressions: warning + non_constant_identifier_names: warning + parameter_assignments: warning + prefer_asserts_with_message: warning + prefer_const_constructors: warning + prefer_const_constructors_in_immutables: warning + prefer_const_literals_to_create_immutables: warning + prefer_expression_function_bodies: warning + prefer_for_elements_to_map_fromIterable: warning + prefer_foreach: warning + prefer_int_literals: warning + prefer_relative_imports: warning + prefer_typing_uninitialized_variables: warning + public_member_api_docs: warning + sort_child_properties_last: warning + sort_unnamed_constructors_first: warning + throw_in_finally: warning + use_setters_to_change_properties: warning + use_string_buffers: warning + use_to_and_as_if_applicable: warning linter: rules: diff --git a/lib/v1.recommended.yaml b/lib/v1.recommended.yaml index 183d6fe..9f39081 100644 --- a/lib/v1.recommended.yaml +++ b/lib/v1.recommended.yaml @@ -66,63 +66,63 @@ include: package:workiva_analysis_options/v1.yaml analyzer: errors: # Promote enabled lints to errors: - always_require_non_null_named_parameters: error - avoid_bool_literals_in_conditional_expressions: error - avoid_function_literals_in_foreach_calls: error - avoid_implementing_value_types: error - avoid_null_checks_in_equality_operators: error - avoid_positional_boolean_parameters: error - avoid_relative_lib_imports: error - avoid_renaming_method_parameters: error - avoid_returning_this: error - avoid_returning_null: error - avoid_returning_null_for_future: error - avoid_returning_null_for_void: error - avoid_setters_without_getters: error - avoid_types_on_closure_parameters: error - avoid_unused_constructor_parameters: error - cascade_invocations: error - comment_references: error - curly_braces_in_flow_control_structures: error - join_return_with_assignment: error - omit_local_variable_types: error - overridden_fields: error - package_api_docs: error - package_prefixed_library_names: error - package_names: error - prefer_adjacent_string_concatenation: error - prefer_asserts_in_initializer_lists: error - prefer_collection_literals: error - prefer_conditional_assignment: error - prefer_const_declarations: error - provide_deprecation_message: error - prefer_final_fields: error - prefer_final_in_for_each: error - prefer_final_locals: error - prefer_function_declarations_over_variables: error - prefer_if_elements_to_conditional_expressions: error - prefer_initializing_formals: error - prefer_inlined_adds: error - prefer_interpolation_to_compose_strings: error - prefer_iterable_whereType: error - prefer_mixin: error - prefer_null_aware_operators: error - prefer_single_quotes: error - prefer_spread_collections: error - prefer_void_to_null: error - sort_pub_dependencies: error - test_types_in_equals: error - type_annotate_public_apis: error - unawaited_futures: error - unnecessary_await_in_return: error - unnecessary_brace_in_string_interps: error - unnecessary_getters_setters: error - unnecessary_lambdas: error - unnecessary_parenthesis: error - unnecessary_overrides: error - unnecessary_this: error - use_function_type_syntax_for_parameters: error - use_rethrow_when_possible: error + always_require_non_null_named_parameters: warning + avoid_bool_literals_in_conditional_expressions: warning + avoid_function_literals_in_foreach_calls: warning + avoid_implementing_value_types: warning + avoid_null_checks_in_equality_operators: warning + avoid_positional_boolean_parameters: warning + avoid_relative_lib_imports: warning + avoid_renaming_method_parameters: warning + avoid_returning_this: warning + avoid_returning_null: warning + avoid_returning_null_for_future: warning + avoid_returning_null_for_void: warning + avoid_setters_without_getters: warning + avoid_types_on_closure_parameters: warning + avoid_unused_constructor_parameters: warning + cascade_invocations: warning + comment_references: warning + curly_braces_in_flow_control_structures: warning + join_return_with_assignment: warning + omit_local_variable_types: warning + overridden_fields: warning + package_api_docs: warning + package_prefixed_library_names: warning + package_names: warning + prefer_adjacent_string_concatenation: warning + prefer_asserts_in_initializer_lists: warning + prefer_collection_literals: warning + prefer_conditional_assignment: warning + prefer_const_declarations: warning + provide_deprecation_message: warning + prefer_final_fields: warning + prefer_final_in_for_each: warning + prefer_final_locals: warning + prefer_function_declarations_over_variables: warning + prefer_if_elements_to_conditional_expressions: warning + prefer_initializing_formals: warning + prefer_inlined_adds: warning + prefer_interpolation_to_compose_strings: warning + prefer_iterable_whereType: warning + prefer_mixin: warning + prefer_null_aware_operators: warning + prefer_single_quotes: warning + prefer_spread_collections: warning + prefer_void_to_null: warning + sort_pub_dependencies: warning + test_types_in_equals: warning + type_annotate_public_apis: warning + unawaited_futures: warning + unnecessary_await_in_return: warning + unnecessary_brace_in_string_interps: warning + unnecessary_getters_setters: warning + unnecessary_lambdas: warning + unnecessary_parenthesis: warning + unnecessary_overrides: warning + unnecessary_this: warning + use_function_type_syntax_for_parameters: warning + use_rethrow_when_possible: warning linter: rules: diff --git a/lib/v1.yaml b/lib/v1.yaml index 3dc365d..eb99769 100644 --- a/lib/v1.yaml +++ b/lib/v1.yaml @@ -64,63 +64,76 @@ analyzer: errors: # Protect against using language features that are incompatible with the # minimum SDK version for the current project: - sdk_version_async_exported_from_core: error - sdk_version_as_expression_in_const_context: error - sdk_version_bool_operator_in_const_context: error - sdk_version_eq_eq_operator_in_const_context: error - sdk_version_extension_methods: error - sdk_version_is_expression_in_const_context: error - sdk_version_set_literal: error - sdk_version_ui_as_code: error - sdk_version_ui_as_code_in_const_context: error + sdk_version_async_exported_from_core: warning + sdk_version_as_expression_in_const_context: warning + sdk_version_bool_operator_in_const_context: warning + sdk_version_eq_eq_operator_in_const_context: warning + sdk_version_extension_methods: warning + sdk_version_is_expression_in_const_context: warning + sdk_version_set_literal: warning + sdk_version_ui_as_code: warning + sdk_version_ui_as_code_in_const_context: warning + + # Promote some builtin hints/infos/warnings to errors: + dead_code: warning + duplicate_hidden_name: warning + duplicate_import: warning + duplicate_shown_name: warning + unused_catch_clause: warning + unused_catch_stack: warning + unused_element: warning + unused_field: warning + unused_import: warning + unused_local_variable: warning + unused_shown_name: warning # Promote enabled lints to errors: - annotate_overrides: error - avoid_double_and_int_checks: error - avoid_empty_else: error - avoid_init_to_null: error - avoid_private_typedef_functions: error - avoid_return_types_on_setters: error - avoid_shadowing_type_parameters: error - avoid_single_cascade_in_expression_statements: error - avoid_types_as_parameter_names: error - await_only_futures: error - camel_case_extensions: error - camel_case_types: error - cancel_subscriptions: error - close_sinks: error - empty_catches: error - empty_constructor_bodies: error - empty_statements: error - file_names: error - hash_and_equals: error - implementation_imports: error - iterable_contains_unrelated_type: error - library_names: error - library_prefixes: error - list_remove_unrelated_type: error - no_adjacent_strings_in_list: error - no_duplicate_case_values: error - null_closures: error - only_throw_errors: error - prefer_contains: error - prefer_equal_for_default_values: error - prefer_generic_function_type_aliases: error - prefer_if_null_operators: error - prefer_is_empty: error - prefer_is_not_empty: error - recursive_getters: error - slash_for_doc_comments: error - type_init_formals: error - unnecessary_const: error - unnecessary_new: error - unnecessary_null_aware_assignments: error - unnecessary_null_in_if_null_operators: error - unnecessary_statements: error - unsafe_html: error - unrelated_type_equality_checks: error - valid_regexps: error - void_checks: error + annotate_overrides: warning + avoid_double_and_int_checks: warning + avoid_empty_else: warning + avoid_init_to_null: warning + avoid_private_typedef_functions: warning + avoid_return_types_on_setters: warning + avoid_shadowing_type_parameters: warning + avoid_single_cascade_in_expression_statements: warning + avoid_types_as_parameter_names: warning + await_only_futures: warning + camel_case_extensions: warning + camel_case_types: warning + cancel_subscriptions: warning + close_sinks: warning + empty_catches: warning + empty_constructor_bodies: warning + empty_statements: warning + file_names: warning + hash_and_equals: warning + implementation_imports: warning + iterable_contains_unrelated_type: warning + library_names: warning + library_prefixes: warning + list_remove_unrelated_type: warning + no_adjacent_strings_in_list: warning + no_duplicate_case_values: warning + null_closures: warning + only_throw_errors: warning + prefer_contains: warning + prefer_equal_for_default_values: warning + prefer_generic_function_type_aliases: warning + prefer_if_null_operators: warning + prefer_is_empty: warning + prefer_is_not_empty: warning + recursive_getters: warning + slash_for_doc_comments: warning + type_init_formals: warning + unnecessary_const: warning + unnecessary_new: warning + unnecessary_null_aware_assignments: warning + unnecessary_null_in_if_null_operators: warning + unnecessary_statements: warning + unsafe_html: warning + unrelated_type_equality_checks: warning + valid_regexps: warning + void_checks: warning linter: rules: diff --git a/pubspec.yaml b/pubspec.yaml index 012dd39..1dc1fc6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: workiva_analysis_options -version: 1.0.0 +version: 1.0.1 homepage: https://github.com/Workiva/workiva_analysis_options description: Workiva's shared static analysis options. diff --git a/test/analysis_options_test.dart b/test/analysis_options_test.dart index c5925e4..61ffb9c 100644 --- a/test/analysis_options_test.dart +++ b/test/analysis_options_test.dart @@ -75,7 +75,7 @@ void main() { final severities = Map.from(yaml['analyzer']['errors']); for (final lint in lints) { - expect(severities, containsPair(lint, 'error')); + expect(severities, containsPair(lint, 'warning')); } }); }