Lints and suggestions for the Nix programming language
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix bug with overriding of config combined with serde

Akshay b1c82808 305960c9

+18 -6
+18 -6
bin/src/config.rs
··· 53 53 pub format: OutFormat, 54 54 55 55 /// Path to statix.toml 56 - #[clap(short = 'c', long = "config", default_value = "./statix.toml")] 56 + #[clap(short = 'c', long = "config", default_value = ".")] 57 57 pub conf_path: PathBuf, 58 58 59 59 /// Enable "streaming" mode, accept file on stdin, output diagnostics on stdout ··· 99 99 pub diff_only: bool, 100 100 101 101 /// Path to statix.toml 102 - #[clap(short = 'c', long = "config", default_value = "./statix.toml")] 102 + #[clap(short = 'c', long = "config", default_value = ".")] 103 103 pub conf_path: PathBuf, 104 104 105 105 /// Enable "streaming" mode, accept file on stdin, output diagnostics on stdout ··· 163 163 pub streaming: bool, 164 164 165 165 /// Path to statix.toml 166 - #[clap(short = 'c', long = "config", default_value = "./statix.toml")] 166 + #[clap(short = 'c', long = "config", default_value = ".")] 167 167 pub conf_path: PathBuf, 168 168 } 169 169 ··· 260 260 impl Default for ConfFile { 261 261 fn default() -> Self { 262 262 let disabled = vec![]; 263 - let nix_version = Some(utils::default_nix_version()); 263 + let nix_version = None; 264 264 Self { 265 265 disabled, 266 266 nix_version, ··· 277 277 pub fn discover<P: AsRef<Path>>(path: P) -> Result<Self, ConfigErr> { 278 278 let cannonical_path = fs::canonicalize(path.as_ref()).map_err(ConfigErr::InvalidPath)?; 279 279 for p in cannonical_path.ancestors() { 280 - let statix_toml_path = p.with_file_name("statix.toml"); 280 + let statix_toml_path = if p.is_dir() { 281 + p.join("statix.toml") 282 + } else { 283 + p.with_file_name("statix.toml") 284 + }; 281 285 if statix_toml_path.exists() { 282 286 return Self::from_path(statix_toml_path); 283 287 }; ··· 285 289 Ok(Self::default()) 286 290 } 287 291 pub fn dump(&self) -> String { 288 - toml::ser::to_string_pretty(&self).unwrap() 292 + let ideal_config = { 293 + let disabled = vec![]; 294 + let nix_version = Some(utils::default_nix_version()); 295 + Self { 296 + disabled, 297 + nix_version, 298 + } 299 + }; 300 + toml::ser::to_string_pretty(&ideal_config).unwrap() 289 301 } 290 302 pub fn lints(&self) -> LintMap { 291 303 utils::lint_map_of(