mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
Add exclude
support to ruff analyze
(#13425)
## Summary Closes https://github.com/astral-sh/ruff/issues/13424.
This commit is contained in:
parent
149fb2090e
commit
910fac781d
8 changed files with 108 additions and 9 deletions
|
@ -23,10 +23,10 @@ pub struct ModuleImports(BTreeSet<SystemPathBuf>);
|
|||
impl ModuleImports {
|
||||
/// Detect the [`ModuleImports`] for a given Python file.
|
||||
pub fn detect(
|
||||
db: &ModuleDb,
|
||||
path: &SystemPath,
|
||||
package: Option<&SystemPath>,
|
||||
string_imports: bool,
|
||||
db: &ModuleDb,
|
||||
) -> Result<Self> {
|
||||
// Read and parse the source code.
|
||||
let file = system_path_to_file(db, path)?;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use ruff_linter::display_settings;
|
||||
use ruff_linter::settings::types::{ExtensionMapping, PreviewMode};
|
||||
use ruff_linter::settings::types::{ExtensionMapping, FilePatternSet, PreviewMode};
|
||||
use ruff_macros::CacheKey;
|
||||
use std::collections::BTreeMap;
|
||||
use std::fmt;
|
||||
|
@ -7,6 +7,7 @@ use std::path::PathBuf;
|
|||
|
||||
#[derive(Debug, Default, Clone, CacheKey)]
|
||||
pub struct AnalyzeSettings {
|
||||
pub exclude: FilePatternSet,
|
||||
pub preview: PreviewMode,
|
||||
pub detect_string_imports: bool,
|
||||
pub include_dependencies: BTreeMap<PathBuf, (PathBuf, Vec<String>)>,
|
||||
|
@ -20,6 +21,7 @@ impl fmt::Display for AnalyzeSettings {
|
|||
formatter = f,
|
||||
namespace = "analyze",
|
||||
fields = [
|
||||
self.exclude,
|
||||
self.preview,
|
||||
self.detect_string_imports,
|
||||
self.extension | debug,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue