mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-01 06:11:21 +00:00
Use tool specific function to perform exclude checks (#15486)
## Summary This PR creates separate functions to check whether the document path is excluded for linting or formatting. The main motivation is to avoid the double `Option` for the call sites and makes passing the correct settings simpler.
This commit is contained in:
parent
aefb607405
commit
bec8441cf5
5 changed files with 47 additions and 17 deletions
|
@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
|
|||
|
||||
use crate::{
|
||||
edit::{NotebookRange, ToRangeExt},
|
||||
resolve::is_document_excluded,
|
||||
resolve::is_document_excluded_for_linting,
|
||||
session::DocumentQuery,
|
||||
PositionEncoding, DIAGNOSTIC_NAME,
|
||||
};
|
||||
|
@ -73,11 +73,10 @@ pub(crate) fn check(
|
|||
|
||||
// If the document is excluded, return an empty list of diagnostics.
|
||||
let package = if let Some(document_path) = document_path.as_ref() {
|
||||
if is_document_excluded(
|
||||
if is_document_excluded_for_linting(
|
||||
document_path,
|
||||
file_resolver_settings,
|
||||
Some(linter_settings),
|
||||
None,
|
||||
linter_settings,
|
||||
query.text_document_language_id(),
|
||||
) {
|
||||
return DiagnosticsMap::default();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue