mirror of
https://github.com/astral-sh/ruff
synced 2026-01-20 21:10:48 -05:00
Support shell expansion in extend paths (#1323)
This commit is contained in:
@@ -7,6 +7,7 @@ use std::path::{Path, PathBuf};
|
||||
use anyhow::{anyhow, Result};
|
||||
use glob::{glob, GlobError, Paths, PatternError};
|
||||
use regex::Regex;
|
||||
use shellexpand;
|
||||
|
||||
use crate::checks_gen::CheckCodePrefix;
|
||||
use crate::cli::{collect_per_file_ignores, Overrides};
|
||||
@@ -78,7 +79,14 @@ impl Configuration {
|
||||
})
|
||||
.collect()
|
||||
}),
|
||||
extend: options.extend.map(PathBuf::from),
|
||||
extend: options
|
||||
.extend
|
||||
.map(|extend| {
|
||||
let extend = shellexpand::full(&extend);
|
||||
extend.map(|extend| PathBuf::from(extend.as_ref()))
|
||||
})
|
||||
.transpose()
|
||||
.map_err(|e| anyhow!("Invalid `extend` value: {e}"))?,
|
||||
extend_exclude: options
|
||||
.extend_exclude
|
||||
.map(|paths| {
|
||||
|
||||
@@ -67,7 +67,8 @@ pub struct Options {
|
||||
pub exclude: Option<Vec<String>>,
|
||||
#[option(
|
||||
doc = r#"
|
||||
A path to a local `pyproject.toml` file to merge into this configuration.
|
||||
A path to a local `pyproject.toml` file to merge into this configuration. User home
|
||||
directory and environment variables will be expanded.
|
||||
|
||||
To resolve the current `pyproject.toml` file, Ruff will first resolve this base
|
||||
configuration file, then merge in any properties defined in the current configuration
|
||||
|
||||
Reference in New Issue
Block a user