Skip to content

Commit

Permalink
Avoid reading unsafe_fixes from nested configuration files
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Oct 6, 2023
1 parent 47b146b commit 859ac7d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/ruff_cli/src/commands/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub(crate) fn check(
cache: flags::Cache,
noqa: flags::Noqa,
fix_mode: flags::FixMode,
unsafe_fixes: UnsafeFixes,
) -> Result<Diagnostics> {
// Collect all the Python files to check.
let start = Instant::now();
Expand Down Expand Up @@ -127,7 +128,7 @@ pub(crate) fn check(
cache,
noqa,
fix_mode,
settings.unsafe_fixes,
unsafe_fixes,
)
.map_err(|e| {
(Some(path.to_owned()), {
Expand Down Expand Up @@ -245,6 +246,7 @@ mod test {

use anyhow::Result;

use ruff_linter::settings::types::UnsafeFixes;
use rustc_hash::FxHashMap;
use tempfile::TempDir;

Expand Down Expand Up @@ -297,6 +299,7 @@ mod test {
flags::Cache::Disabled,
flags::Noqa::Disabled,
flags::FixMode::Generate,
UnsafeFixes::Enabled,
)
.unwrap();
let mut output = Vec::new();
Expand Down
3 changes: 3 additions & 0 deletions crates/ruff_cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result<ExitStatus> {
cache.into(),
noqa.into(),
fix_mode,
unsafe_fixes,
)?;
printer.write_continuously(&mut writer, &messages)?;

Expand Down Expand Up @@ -360,6 +361,7 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result<ExitStatus> {
cache.into(),
noqa.into(),
fix_mode,
unsafe_fixes,
)?;
printer.write_continuously(&mut writer, &messages)?;
}
Expand All @@ -386,6 +388,7 @@ pub fn check(args: CheckCommand, log_level: LogLevel) -> Result<ExitStatus> {
cache.into(),
noqa.into(),
fix_mode,
unsafe_fixes,
)?
};

Expand Down

0 comments on commit 859ac7d

Please sign in to comment.