Enable notebooks by default in preview mode (#12621)

This commit is contained in:
Micha Reiser 2024-08-02 15:36:53 +02:00 committed by GitHub
parent fbab04fbe1
commit 012198a1b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 142 additions and 4 deletions

View file

@ -230,9 +230,15 @@ impl Configuration {
extend_exclude: FilePatternSet::try_from_iter(self.extend_exclude)?,
extend_include: FilePatternSet::try_from_iter(self.extend_include)?,
force_exclude: self.force_exclude.unwrap_or(false),
include: FilePatternSet::try_from_iter(
self.include.unwrap_or_else(|| INCLUDE.to_vec()),
)?,
include: FilePatternSet::try_from_iter(self.include.unwrap_or_else(|| {
let mut include = INCLUDE.to_vec();
if global_preview.is_enabled() {
include.push(FilePattern::Builtin("*.ipynb"));
}
include
}))?,
respect_gitignore: self.respect_gitignore.unwrap_or(true),
project_root: project_root.to_path_buf(),
},

View file

@ -241,6 +241,10 @@ pub struct Options {
/// included here not for configuration but because we lint whether e.g. the
/// `[project]` matches the schema.
///
/// If [preview](https://docs.astral.sh/ruff/preview/) is enabled, the default
/// includes notebook files (`.ipynb` extension). You can exclude them by adding
/// `*.ipynb` to [`extend-exclude`](#extend-exclude).
///
/// For more information on the glob syntax, refer to the [`globset` documentation](https://docs.rs/globset/latest/globset/#syntax).
#[option(
default = r#"["*.py", "*.pyi", "**/pyproject.toml"]"#,