Skip to content

Add --validate flow with per-entry no_expand#32

Merged
MikeGarde merged 1 commit into
mainfrom
feat/31-validate
Jul 15, 2026
Merged

Add --validate flow with per-entry no_expand#32
MikeGarde merged 1 commit into
mainfrom
feat/31-validate

Conversation

@MikeGarde

Copy link
Copy Markdown
Owner

Enable standalone validation and expansion control across files

  • Add -V/--validate CLI flag to run env-file validation as a separate flow and disallow conflicting options
  • Introduce per-entry no_expand flag on EnvValue; default remains false and single-quoted values are treated as literals when set
  • Refactor parsing to collect all formatting issues (whitespace around = and duplicates) and return a single EnvParseError with the first offending line and a combined message; apply no_expand for single-quoted values
  • Centralize path resolution in resolve_env_path (defaults, absolute resolution, existence checks); main uses it and prints <path> is valid on success
  • Update error output to print only the error message and remove ad-hoc path handling in run paths
  • Update README: align badge to Rust branding and add a “Validating a File” section with an example (dotenv --validate --file .env.example)
  • Add tests/fixtures for validation: space.env and singleQuote.env, test valid/invalid/missing cases, exclusivity with other options, and whitespace/duplicate-key diagnostics
  • Improve error messaging for unterminated quotes and extend tests for quote-sensitive expansion and end-to-end fixture validation

Enable standalone validation and expansion control across files
- Add `-V/--validate` CLI flag to run env-file validation as a separate flow and disallow conflicting options
- Introduce per-entry `no_expand` flag on `EnvValue`; default remains false and single-quoted values are treated as literals when set
- Refactor parsing to collect all formatting issues (whitespace around `=` and duplicates) and return a single `EnvParseError` with the first offending line and a combined message; apply `no_expand` for single-quoted values
- Centralize path resolution in `resolve_env_path` (defaults, absolute resolution, existence checks); main uses it and prints `<path> is valid` on success
- Update error output to print only the error message and remove ad-hoc path handling in run paths
- Update README: align badge to Rust branding and add a “Validating a File” section with an example (`dotenv --validate --file .env.example`)
- Add tests/fixtures for validation: `space.env` and `singleQuote.env`, test valid/invalid/missing cases, exclusivity with other options, and whitespace/duplicate-key diagnostics
- Improve error messaging for unterminated quotes and extend tests for quote-sensitive expansion and end-to-end fixture validation
@MikeGarde
MikeGarde merged commit 1432f9f into main Jul 15, 2026
1 check passed
@MikeGarde
MikeGarde deleted the feat/31-validate branch July 15, 2026 03:48
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.89041% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/env_object.rs 85.71% 1 Missing ⚠️
src/env_parser.rs 96.87% 1 Missing ⚠️
src/main.rs 97.05% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/env_object.rs 80.68% <85.71%> (+0.19%) ⬆️
src/env_parser.rs 92.39% <96.87%> (+0.67%) ⬆️
src/main.rs 72.97% <97.05%> (+2.51%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@MikeGarde MikeGarde linked an issue Jul 15, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate a file

1 participant