Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skipping of commented or empty lines #37

Merged
merged 2 commits into from Jan 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### 🚀 Added
- Add skipping of commented or empty lines [#36](https://github.com/mgrachev/dotenv-linter/pull/36) ([@mstruebing](https://github.com/mstruebing))
mstruebing marked this conversation as resolved.
Show resolved Hide resolved

## [v1.0.0] - 2020-01-01
### 🚀 Added
- Add check: Keys without values [#22](https://github.com/mgrachev/dotenv-linter/pull/22) ([@mstruebing](https://github.com/mstruebing))
Expand Down
6 changes: 6 additions & 0 deletions src/lib.rs
Expand Up @@ -35,6 +35,12 @@ pub fn run() -> Result<(), Error> {

for (index, line) in reader.lines().enumerate() {
let raw_string = line?;

// A comment or empty line should just be skipped
if raw_string.starts_with('#') || raw_string.trim().is_empty() {
continue;
}

let number = index + 1;

checks::run(&LineEntry { number, raw_string })
Expand Down