realm / realm/SwiftLint

Whitelist_rules with Parameters

Open
#3,665 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help
Dominant language
Swift
Stars
19.7k
Forks
2.3k
Avg merge
1d 1h
Merged PRs (30d)
11

Description

Describe the bug

When I do a whitelist_rules swiftlint.yml config file I they work up until I try to add a parameter into the rule

excluded:
    - Pods
    - sfzfans/Extensions/GoodSwift.swift

whitelist_rules:
# Lint: Extra Code that doesn't do anything
- superfluous_disable_command
- unused_capture_list
- unused_closure_parameter
- unused_declaration
- unused_enumerated
- unused_import
- unused_setter_value
- unneeded_break_in_switch
# Style
- unneeded_parentheses_in_closure_argument
- return_arrow_whitespace
- protocol_property_accessors_order
- redundant_discardable_let
- shorthand_operator
# Space Formatting
# Switch
- switch_case_alignment
# Other
- trailing_closure
- trailing_comma
- trailing_semicolon
- trailing_whitespace
- vertical_whitespace
- operator_usage_whitespace
- operator_whitespace
- opening_brace
- no_space_in_method_call
- leading_whitespace
- let_var_whitespace
- closure_spacing
- colon
- comma
# New line formatting
# Switch
- vertical_whitespace_between_cases
- switch_case_on_newline
# Other
- multiline_arguments
- multiline_arguments_brackets
- multiline_literal_brackets
- multiline_parameters
- multiline_parameters_brackets
- multiple_closures_with_trailing_closure
- closure_parameter_position
# Alignment
# Switch
- switch_case_alignment
# Other
- closure_end_indentation
- collection_alignment
# Lack of description
- fatal_error_message
# Prone to logical errors
- anyobject_protocol
- weak_delegate
- empty_count
- empty_string
- force_cast
- force_try
- force_unwrapping
- identical_operands
- overridden_super_call
- yoda_condition
- class_delegate_protocol
# Legacy
- legacy_cggeometry_functions
- legacy_constant
- legacy_constructor
- legacy_hashing
- legacy_multiple
- legacy_nsgeometry_functions
- legacy_random
# Idiomatic: Can be written in a more human centered language
- toggle_bool
- syntactic_suga
- redundant_type_annotation
- redundant_set_access_control
- redundant_optional_initialization
- redundant_objc_attribute
- prefer_zero_over_explicit_init
- redundant_nil_coalescing
- redundant_string_enum_value
- static_operator
- number_separator
# Readability, Indentation, spacing
- control_statement
- for_where
- joined_default_parameter
# Expression Redundancy
- explicit_init
- empty_collection_literal
- empty_enum_arguments
- empty_parameters
- empty_parentheses_with_trailing_closure
# Performace related
- private_action
- private_outlet
- contains_over_filter_count
- contains_over_filter_is_empty
- contains_over_first_not_nil
- contains_over_range_nil_comparison
- extension_access_modifier
- first_where
- flatmap_over_map_reduce
- last_where
- reduce_boolean
# Parameters Count
- large_tuple:
    warning: 3
    error: 4
- enum_case_associated_values_count:
    warning: 3
    error: 4
- function_parameter_count:
    warning: 5
    error: 6
- line_length:
    warning: 100
    error: 400

Whenever I remove the parameter count rules , it works as expected. When I add them the file break and filters by default ruleset.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied swiftlint.yml and reproduce the failure using the whitelist_rules entries that include warning and error parameters. Trace how SwiftLint loads parameterized rules from this configuration and compare it with the behavior when those entries are removed. Done means parameterized whitelist rules are honored instead of causing the default ruleset to be used.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.