Skip to content

Commit 626b4f7

Browse files
committed
refactor(config): Centralize pyproject.toml value
1 parent ba52e28 commit 626b4f7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

crates/typos-cli/src/config.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ use kstring::KString;
55
use crate::file_type_specifics;
66

77
pub const SUPPORTED_FILE_NAMES: &[&str] =
8-
&["typos.toml", "_typos.toml", ".typos.toml", "pyproject.toml"];
8+
&["typos.toml", "_typos.toml", ".typos.toml", PYPROJECT_TOML];
9+
10+
const PYPROJECT_TOML: &str = "pyproject.toml";
911

1012
#[derive(Debug, Clone, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
1113
#[serde(deny_unknown_fields)]
@@ -55,11 +57,11 @@ impl Config {
5557
)
5658
})?;
5759

58-
if path.file_name().unwrap() == "pyproject.toml" {
60+
if path.file_name().unwrap() == PYPROJECT_TOML {
5961
let config = toml::from_str::<PyprojectTomlConfig>(&s)?;
6062

6163
if config.tool.typos.is_none() {
62-
log::debug!("No `tool.typos` section found in `pyproject.toml`, skipping");
64+
log::debug!("No `tool.typos` section found in `{PYPROJECT_TOML}`, skipping");
6365

6466
Ok(None)
6567
} else {

0 commit comments

Comments
 (0)