Skip to content

Add apply_to_files and skip_files parameter to rules and config#341

Merged
jeparlefrancais merged 12 commits intomainfrom
rule-filters
Feb 24, 2026
Merged

Add apply_to_files and skip_files parameter to rules and config#341
jeparlefrancais merged 12 commits intomainfrom
rule-filters

Conversation

@jeparlefrancais
Copy link
Copy Markdown
Contributor

@jeparlefrancais jeparlefrancais commented Feb 22, 2026

Closes #7

These changes add a per-rule file filtering to control which files are processed by a rule.

  • apply_to_files: only files whose path matches at least one pattern are processed
  • skip_files: files matching any of the provided patterns are skipped. This is applied after apply_to_files, so both can be combined (e.g. only src/**/*.luau but skip **/*.test.luau).

Both fields are also added as parameters to the configuration, and they control if all the rules are applied or not.

Rule Example

"rules": [
  {
    "rule": "rename_variables",
    "apply_to_files": ["src/**/*.luau"],
    "include_functions": false
  }
]

  • add entry to the changelog

@github-actions
Copy link
Copy Markdown

Coverage after merging rule-filters into main will be

85.20%

Coverage Report for Changed Files
FileStmtsBranchesFuncsLinesUncovered Lines
src/frontend
   configuration.rs82.70%100%81.13%82.99%107–110, 114–118, 122–125, 129–133, 201–215, 217–218, 255–259, 74–76, 87–90
   error.rs66.34%100%66.67%66.30%117–122, 128–130, 132–134, 173, 181, 187, 194, 221–225, 227–235, 246–249, 251, 255–260, 273–278, 282–287, 291–296, 300–305, 317–318, 329, 331–332, 334–335, 352, 361, 394, 396, 401–402, 409, 418, 420–421, 423–424, 427–429, 431–432, 434–435
   worker.rs75.82%100%72.22%76.08%102, 107, 111–113, 137–138, 149–150, 158–159, 163, 165, 167–168, 176, 210, 219–221, 223, 247–250, 257, 259–260, 262, 264–268, 291, 308, 318, 326, 328, 330–331, 379, 398–399, 415, 45, 52, 80, 92, 94–99
src/rules
   append_text_comment.rs82.98%100%88.89%82.35%105–108, 126–127, 170–175, 212–214, 34–41, 52, 54–57
   call_parens.rs100%100%100%100%
   compute_expression.rs92.23%100%100%90.80%21, 37, 53, 69, 74, 82, 89, 92
   convert_index_to_field.rs100%100%100%100%
   convert_luau_number.rs94.52%100%92.31%95%88–90
   convert_square_root_call.rs89.52%100%86.67%90%130–132, 30, 50–51, 60–62
   empty_do.rs100%100%100%100%
   filter_early_return.rs97.10%100%100%96.49%22–23
   global_function_to_assign.rs95.12%100%91.67%95.71%101–103
   group_local.rs91.92%100%92.86%91.76%134–136, 38–40, 44
   inject_value.rs88.95%100%93.94%88.46%186, 193, 201–210, 212–221, 226–232, 238, 246, 248, 74, 78–79
   method_def.rs100%100%100%100%
   mod.rs86.16%100%78.72%87.10%146–148, 167–169, 184, 205, 207, 209–210, 255–257, 275–278, 280–284, 286–289, 291–295, 427, 459, 500, 513–515, 544, 554, 564, 571–574, 594
   no_local_function.rs94.74%100%91.67%95.31%90–92
   remove_assertions.rs97.35%100%100%96.94%42, 54
   remove_attribute.rs84.06%100%84%84.07%143–145, 46–50, 69–73, 94–95
   remove_comments.rs89.70%100%87.80%90.32%100, 102, 104–106, 320, 360–367, 371, 373, 375–377, 387, 468, 546–547, 89–96
   remove_compound_assign.rs95.69%100%92.31%96.12%272–274, 335–337, 55, 83
   remove_continue.rs96.41%100%96.55%96.38%129, 201–203, 77
   remove_debug_profiling.rs97.73%100%100%97.37%54
   remove_floor_division.rs85.58%100%93.33%84.27%102–110, 134–136, 47–48
   remove_if_expression.rs95.92%100%92.31%96.47%122–124
   remove_interpolated_string.rs95.26%100%100%94.77%210–217
   remove_method_call.rs92.96%100%90.91%93.33%100, 38, 98–99
   remove_nil_declarations.rs100%100%100%100%
   remove_spaces.rs92.50%100%94.92%91.86%100, 102, 104–106, 278, 289–291, 89–96
   remove_types.rs95.65%100%94.44%95.95%100–101, 99
   remove_unused_variable.rs96.93%100%100%96.55%146, 177–180, 182–183
   replace_referenced_tokens.rs88.50%100%90.32%88%100–104, 108, 110, 112–114, 194–196, 205, 283–286, 296–298, 300–302, 97–99
   shift_token_line.rs87.82%100%89.83%87.26%100–104, 108, 110, 112–114, 118, 194–196, 295–298, 308–310, 312–314, 97–99
   unused_if_branch.rs88.82%100%94.12%88.24%112–113, 142, 150–151, 170–172, 39, 47–48, 61, 67, 79–80, 94–96
   unused_while.rs100%100%100%100%
src/rules/bundle
   mod.rs85.83%100%85%86%110–114, 124–126, 128–130, 36–37, 42
src/rules/convert_require
   mod.rs92.44%100%91.30%92.62%117–119, 142, 152–153, 49, 72–73
src/rules/rename_variables
   mod.rs97.37%100%100%96.92%126, 51–52, 54
src/utils
   filter_pattern.rs81.82%100%71.43%84.62%16–18
   mod.rs96.48%100%96%96.58%60–61, 68
   serde_one_or_many.rs100%100%100%100%

@jeparlefrancais jeparlefrancais merged commit 16e566c into main Feb 24, 2026
6 checks passed
@jeparlefrancais jeparlefrancais deleted the rule-filters branch February 24, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add pattern option to filter files

1 participant