ruff/crates/ruff/tests
Brent Westbrook d93ed293eb
Escape template filenames in glob patterns (#16407)
## Summary

Fixes #9381. This PR fixes errors like 

```
Cause: error parsing glob '/Users/me/project/{{cookiecutter.project_dirname}}/__pycache__': nested alternate groups are not allowed
```

caused by glob special characters in filenames like
`{{cookiecutter.project_dirname}}`. When the user is matching that
directory exactly, they can use the workaround given by
https://github.com/astral-sh/ruff/issues/7959#issuecomment-1764751734,
but that doesn't work for a nested config file with relative paths. For
example, the directory tree in the reproduction repo linked
[here](https://github.com/astral-sh/ruff/issues/9381#issuecomment-2677696408):

```
.
├── README.md
├── hello.py
├── pyproject.toml
├── uv.lock
└── {{cookiecutter.repo_name}}
    ├── main.py
    ├── pyproject.toml
    └── tests
        └── maintest.py
```

where the inner `pyproject.toml` contains a relative glob:

```toml
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["F811"]
```

## Test Plan

A new CLI test in both the linter and formatter. The formatter test may
not be necessary because I didn't have to modify any additional code to
pass it, but the original report mentioned both `check` and `format`, so
I wanted to be sure both were fixed.
2025-03-03 09:29:58 -05:00
..
snapshots Add `per-file-target-version` option (#16257) 2025-02-24 08:47:13 -05:00
analyze_graph.rs Don't skip over imports and other nodes containing nested statements in import collector (#13521) 2024-09-26 11:57:05 +00:00
config.rs nit: docs for ignore & select (#15883) 2025-02-04 10:05:41 +01:00
format.rs Escape template filenames in glob patterns (#16407) 2025-03-03 09:29:58 -05:00
integration_test.rs test: update snapshots with just whitespace changes 2025-01-15 13:37:52 -05:00
lint.rs Escape template filenames in glob patterns (#16407) 2025-03-03 09:29:58 -05:00
resolve_files.rs Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00
show_settings.rs show-settings: Properly filter out backslashes on windows (#15612) 2025-01-20 10:57:21 +01:00
version.rs Update insta snapshots (#14366) 2024-11-15 19:31:15 +01:00