iOS/.swiftlint.yml
Bruno Pantaleão Gonçalves 5f435fa349
Add swiftlint rule to check for unsafe SFSymbol usage (#3700)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2025-07-07 10:50:25 +02:00

74 lines
1.8 KiB
YAML

only_rules:
- block_based_kvo
- class_delegate_protocol
- compiler_protocol_init
- contains_over_filter_count
- cyclomatic_complexity
- deployment_target
- discarded_notification_center_observer
- discouraged_direct_init
- duplicate_enum_cases
- dynamic_inline
- fallthrough
- for_where
- force_cast
- force_try
- generic_type_name
- identical_operands
- inclusive_language
- is_disjoint
- legacy_cggeometry_functions
- legacy_constant
- legacy_constructor
- legacy_hashing
- legacy_multiple
- legacy_nsgeometry_functions
- legacy_random
- nsobject_prefer_isequal
- override_in_extension
- prefer_self_type_over_type_of_self
- private_unit_test
- prohibited_super_call
- reduce_boolean
- redundant_objc_attribute
- static_operator
- superfluous_disable_command
- test_case_accessibility
- unneeded_break_in_switch
- unowned_variable_capture
- unused_control_flow_label
- unused_declaration
- unused_enumerated
- unused_optional_binding
- unused_setter_value
- weak_delegate
- xct_specific_matcher
- xctfail_message
- custom_rules
cyclomatic_complexity:
ignores_case_statements: true
excluded:
- fastlane
- Tests
- Pods
- vendor
- "**/**/.build"
- "./.swiftlint.yml"
custom_rules:
prohibit_environment_assignment:
name: "Assigning to Environment variables is not allowed."
regex: '\bCurrent\.[a-zA-Z_][a-zA-Z0-9_]*\s*=(?!=)'
message: "Avoid assigning to `Current`."
severity: error
excluded:
- "Tests"
sf_safe_symbol:
name: "Safe SFSymbol"
message: "Use `SFSafeSymbols` via `systemSymbol` parameters for type safety."
regex: >
(Image\\(systemName:)|(NSImage\\(symbolName:)|(Label[^,]+?,\\s*systemImage:)|(UIApplicationShortcutIcon\\(systemImageName:)
severity: warning