Ignore Jupyter Notebooks for --add-noqa (#5727)

This commit is contained in:
Dhruv Manilawala 2023-07-13 13:26:47 +05:30 committed by GitHub
parent 067b2a6ce6
commit e9771c9c63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,7 +9,7 @@ use rayon::prelude::*;
use ruff::linter::add_noqa_to_path; use ruff::linter::add_noqa_to_path;
use ruff::resolver::PyprojectConfig; use ruff::resolver::PyprojectConfig;
use ruff::{packaging, resolver, warn_user_once}; use ruff::{packaging, resolver, warn_user_once};
use ruff_python_stdlib::path::is_project_toml; use ruff_python_stdlib::path::{is_jupyter_notebook, is_project_toml};
use crate::args::Overrides; use crate::args::Overrides;
@ -47,7 +47,7 @@ pub(crate) fn add_noqa(
.flatten() .flatten()
.filter_map(|entry| { .filter_map(|entry| {
let path = entry.path(); let path = entry.path();
if is_project_toml(path) { if is_project_toml(path) || is_jupyter_notebook(path) {
return None; return None;
} }
let package = path let package = path