dotenv-core

Crates.iodotenv-core
lib.rsdotenv-core
version0.1.1
created_at2025-10-18 13:59:19.623474+00
updated_at2025-10-18 14:15:36.153017+00
descriptionCommon crate for dotenv-linter crates
homepagehttps://github.com/dotenv-linter/dotenv-linter
repositoryhttps://github.com/dotenv-linter/dotenv-linter
max_upload_size
id1889229
size16,132
Grachev Mikhail (mgrachev)

documentation

https://docs.rs/dotenv-core

README

Dotenv-core

CI Version Docs.rs Downloads

Common crate for dotenv-linter crates.

Usage

Add dotenv-core and other dependencies to Cargo.toml:

[dependencies]
dotenv-analyzer = "0.1"
dotenv-core = "0.1"
dotenv-finder = "0.1"

To check .env files

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let current_dir = std::env::current_dir()?;

    let files = dotenv_finder::FinderBuilder::new(&current_dir)
        .build()
        .find();

    for (file, lines) in files {
        let warnings = dotenv_analyzer::check(&lines, &[], None);

        for warning in warnings {
            println!(
                "Warning {file}:{}:{}",
                warning.check_name(),
                warning.message()
            );
        }
    }

    Ok(())
}

To fix .env files

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let current_dir = std::env::current_dir()?;

    let files = dotenv_finder::FinderBuilder::new(&current_dir)
        .build()
        .find();

    for (_, mut lines) in files {
        let warnings = dotenv_analyzer::check(&lines, &[], None);

        dotenv_analyzer::fix(&warnings, &mut lines, &[]);
    }

    Ok(())
}

MSRV

Minimum Supported Rust Version: 1.56.1

License

MIT

Commit count: 454

cargo fmt