Skip to content

Commit 6e6242c

Browse files
qlty fmt --all
1 parent 5bb54bd commit 6e6242c

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

qlty-check/src/planner/config.rs

+19-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use super::{ActivePlugin, Planner};
22
use anyhow::bail;
33
use anyhow::{anyhow, Result};
44
use qlty_analysis::workspace_entries::TargetMode;
5-
use qlty_config::config::{DriverDef, EnabledPlugin, IssueMode, PluginDef, Platform};
5+
use qlty_config::config::{DriverDef, EnabledPlugin, IssueMode, Platform, PluginDef};
66
use semver::{Version, VersionReq};
77
use std::path::{Path, PathBuf};
88
use tracing::{debug, trace, warn};
@@ -48,8 +48,17 @@ fn configure_plugins(planner: &Planner) -> Result<Vec<ActivePlugin>> {
4848
continue;
4949
}
5050

51-
if let Some(plugin_def) = planner.config.plugins.definitions.get(enabled_plugin.name.as_str()) {
52-
if !plugin_def.supported_platforms.is_empty() && !plugin_def.supported_platforms.contains(&Platform::current()) {
51+
if let Some(plugin_def) = planner
52+
.config
53+
.plugins
54+
.definitions
55+
.get(enabled_plugin.name.as_str())
56+
{
57+
if !plugin_def.supported_platforms.is_empty()
58+
&& !plugin_def
59+
.supported_platforms
60+
.contains(&Platform::current())
61+
{
5362
warn!(
5463
"Plugin {} is not supported on this platform ({}), skipping. (Supported platforms are: {})",
5564
enabled_plugin.name,
@@ -557,14 +566,12 @@ mod test {
557566
);
558567

559568
let planner = build_planner(QltyConfig {
560-
plugin: vec![
561-
EnabledPlugin {
562-
name: "enabled".to_string(),
563-
prefix: Some("prefix".to_string()),
564-
drivers: vec![ALL.to_string()],
565-
..Default::default()
566-
},
567-
],
569+
plugin: vec![EnabledPlugin {
570+
name: "enabled".to_string(),
571+
prefix: Some("prefix".to_string()),
572+
drivers: vec![ALL.to_string()],
573+
..Default::default()
574+
}],
568575
plugins: PluginsConfig {
569576
downloads: HashMap::new(),
570577
releases: HashMap::new(),
@@ -576,7 +583,7 @@ mod test {
576583
let plugins: Vec<ActivePlugin> = enabled_plugins(&planner).unwrap();
577584

578585
assert!(plugins.is_empty());
579-
}
586+
}
580587

581588
#[test]
582589
fn test_config_plugin_prefix_package_file() {

qlty-config/src/config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ pub use language::Language;
2222
pub use plugin::{
2323
CheckTrigger, DriverBatchBy, DriverDef, DriverType, EnabledPlugin, ExtraPackage,
2424
InvocationDirectoryDef, InvocationDirectoryType, IssueMode, OutputDestination, OutputFormat,
25-
PackageFileCandidate, Platform, PluginDef, PluginEnvironment, PluginFetch, Runtime, SuggestionMode,
26-
TargetDef, TargetType,
25+
PackageFileCandidate, Platform, PluginDef, PluginEnvironment, PluginFetch, Runtime,
26+
SuggestionMode, TargetDef, TargetType,
2727
};
2828
pub use release::ReleaseDef;
2929
pub use source::SourceDef;

qlty-config/src/config/plugin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ impl Platform {
804804
vec![Platform::Linux, Platform::MacOS, Platform::Windows]
805805
}
806806

807-
pub fn current () -> Platform {
807+
pub fn current() -> Platform {
808808
if cfg!(target_os = "linux") {
809809
Platform::Linux
810810
} else if cfg!(target_os = "macos") {
@@ -826,4 +826,4 @@ impl fmt::Display for Platform {
826826
};
827827
write!(f, "{}", name)
828828
}
829-
}
829+
}

0 commit comments

Comments
 (0)