Skip to content

Commit df74cf5

Browse files
marschatthaclaude
andcommitted
fix(check): skip exported config for formatters when workspace file exists
For formatters, the exported config was always symlinked into the staging area since it starts empty, effectively ignoring any pre-existing file in the workspace root. This was inconsistent with linter behavior, where a pre-existing workspace file takes precedence. Now check if the file already exists in the workspace root before symlinking the exported config into the staging area. If it does, skip the exported config so the workspace file is used instead, matching the linter behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent cb4269b commit df74cf5

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

qlty-check/src/executor.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -316,13 +316,19 @@ impl Executor {
316316

317317
// load exported config paths before anything else
318318
for config_file in &exported_config_paths {
319+
let file_name = config_file.file_name().unwrap();
320+
let workspace_file = self.plan.workspace.root.join(file_name);
321+
319322
if self.plan.workspace.root != self.plan.staging_area.destination_directory {
320-
// for formatters
321-
if let Some(path) = load_config_file_from_source(
322-
config_file,
323-
&self.plan.staging_area.destination_directory,
324-
)? {
325-
loaded_config_files.push(path);
323+
// for formatters: skip if the file already exists in the workspace root
324+
// so that the user's config takes precedence, consistent with linter behavior
325+
if !workspace_file.exists() {
326+
if let Some(path) = load_config_file_from_source(
327+
config_file,
328+
&self.plan.staging_area.destination_directory,
329+
)? {
330+
loaded_config_files.push(path);
331+
}
326332
}
327333
}
328334

0 commit comments

Comments
 (0)