Configuration for gdck.
Defaults come from the GDScript style guide, so a project with no configuration file at all gets style-guide behaviour.
Reading a project's settings
[resolve] walks up from a directory and returns the settings in force
there, along with the files they came from:
let loaded = gdck_config::resolve(std::path::Path::new("."))?;
println!("{} columns", loaded.config.format.line_length);
# Ok::<(), gdck_config::Error>(())
The nearest gdck.toml wins outright. Failing that, gdtoolkit's own
gdformatrc and gdlintrc are read, so a project already using gdformat
and gdlint keeps its line length and its disabled rules without writing
anything new. See docs/CONFIG.md for the schema and the precedence.
Two file formats, two approaches
gdck.toml is read by the [toml] crate, and validated here for the
things a deserialiser cannot know — ranges, and settings that only mean
something alongside another.
The gdtoolkit files are read by [yaml_serde] into an untyped mapping
rather than into a struct, because a gdlintrc holds dozens of settings
gdck has no equivalent for and each should be skipped with a note rather
than failing the file. A file that cannot be parsed at all is an error:
none of its settings would apply, and a project formatted by rules it had
written down and rejected is the outcome worse than not running.