Skip to content

Slowdown when adding excluded files #6028

Closed

Description

@Ernest0-Production

New Issue Checklist

Bug Description

I ran benchmarks and noticed that the linter starts to run for a loooong time if swiftlint.yml contains excluded files/folders.

The waiting time does not depend on the number of rules in the config and the number of files to lint.

When I commented out the excluded block, the lint passed instantly!

excluded:
  - .build                                # SPM artifacts
  - ./**/Generated/*              # SwiftGen artifacts
  - ./**/Derived/Sources/*    # Tuist artifacts
  - Tuist/
  - ./**/Project.swift
  - Workspace.swift

Environment

  • SwiftLint version 0.58.2
  • Xcode version 16.2
  • Installation method used mise-en-place
  • Configuration file:
disabled_rules: # rule identifiers to exclude from running
  - line_length
  - function_body_length
  - type_body_length
  - file_length
  - trailing_comma
  - redundant_type_annotation
  - todo
  - inclusive_language

opt_in_rules:
  - array_init
  - closure_end_indentation
  - closure_spacing
  - collection_alignment
  - contains_over_filter_count
  - contains_over_filter_is_empty
  - contains_over_first_not_nil
  - contains_over_range_nil_comparison
  - empty_collection_literal
  - explicit_init
  - first_where
  - flatmap_over_map_reduce
  - last_where
  - legacy_multiple
  - legacy_random
  - let_var_whitespace
  - object_literal
  - operator_usage_whitespace
  - overridden_super_call
  - raw_value_for_camel_cased_codable_enum
  - redundant_nil_coalescing
  - redundant_type_annotation
  - sorted_first_last
  - sorted_imports
  - toggle_bool
  - unneeded_parentheses_in_closure_argument
  - yoda_condition
  - implicit_return
  - force_unwrapping
  - fatal_error_message
  - file_name_no_space
  - joined_default_parameter
  - nslocalizedstring_key
  - switch_case_on_newline
  - empty_count
  - unowned_variable_capture
  - multiline_parameters
  - multiline_parameters_brackets
  - no_space_in_method_call
  - private_action
  - vertical_whitespace_closing_braces
  - literal_expression_end_indentation
  - modifier_order
  - number_separator
  - optional_enum_case_matching
  - unavailable_function
  - multiline_literal_brackets
  - multiline_arguments
  - multiline_function_chains
  - vertical_parameter_alignment_on_call
  - indentation_width
  - empty_string
  - weak_delegate
  - missing_docs
  - multiline_arguments_brackets

analyzer_rules:
  - unused_declaration
  - unused_import
excluded:
  - .build
  - ./**/Generated/*
  - ./**/Derived/Sources/*
  - Tuist/
  - ./**/Project.swift
  - Workspace.swift

Activity

  1. changed the title [-]Slowdown when adding excluded[/-] [+]Slowdown when adding excluded files[/+] on Mar 22, 2025
  2. SimplyDanny commented on Mar 22, 2025

    @SimplyDanny
    Collaborator

    This is a known issue with ** excludes. The general advice is to avoid them and be more specific in your exclude patterns. There is work in progress to improve this situation, but I don't see a fix incoming any time soon.

    Closing in favor of the re-opened #5018.

  3. added
    bug
    duplicate
    on Mar 22, 2025
  4. Ernest0-Production commented on Mar 22, 2025

    @Ernest0-Production
    Author

    @SimplyDanny the problem is not only with **.

    I specify a specific just .build directory without intermediate **.

    This also slows down the process a lot (if you comment out the other exlusions)

  5. SimplyDanny commented on Mar 22, 2025

    @SimplyDanny
    Collaborator

    @SimplyDanny the problem is not only with **.

    Correct. The performance problem comes with many files involved. This is often the case for ** exclusions and people have been able to improve the situation by avoiding them. That's why I recommended them as a potentially easy fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugduplicate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions