Skip to content

Commit

Permalink
chore: bump wdl dependency version (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-frantz authored Jul 17, 2024
1 parent e82f8a6 commit b3e4679
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ nonempty = "0.9.0"
pest = { version = "2.7.5", features = ["pretty-print"] }
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
wdl = { version = "0.5.0", features = ["codespan"] }
wdl = { version = "0.6.0", features = ["codespan"] }
walkdir = "2.4.0"
colored = "2.1.0"
54 changes: 27 additions & 27 deletions src/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ use codespan_reporting::files::SimpleFiles;
use codespan_reporting::term::termcolor::StandardStream;
use codespan_reporting::term::Config;
use indexmap::IndexMap;
use wdl::ast::Document;
use wdl::ast::Validator;
use wdl::lint::LintVisitor;

use crate::report::Reporter;
Expand Down Expand Up @@ -154,35 +156,33 @@ impl Repository {

for (_path, handle) in self.handles.iter() {
let file = self.sources.get(*handle).expect("Expected to find file");
match wdl::ast::Document::parse(file.source()).into_result() {
Ok(document) => {
let validator = wdl::ast::Validator::default();
if let Err(diagnostics) = validator.validate(&document) {
reporter.emit_diagnostics(file, &diagnostics)?;
syntax_failure = true;
continue;
}
let (document, diagnostics) = Document::parse(file.source());
if !diagnostics.is_empty() {
reporter.emit_diagnostics(file, &diagnostics)?;
syntax_failure = true;
continue;
}

if lint {
let mut linter = wdl::ast::Validator::empty();
let visitor =
LintVisitor::new(wdl::lint::rules().into_iter().filter_map(|rule| {
if except_rules.contains(&rule.id().to_string()) {
None
} else {
Some(rule)
}
}));
linter.add_visitor(visitor);
if let Err(diagnostics) = linter.validate(&document) {
reporter.emit_diagnostics(file, &diagnostics)?;
lint_failure = true;
}
let mut validator = Validator::default();
if let Err(diagnostic) = validator.validate(&document) {
reporter.emit_diagnostics(file, &diagnostic)?;
syntax_failure = true;
continue;
}

if lint {
let mut linter = Validator::empty();
let visitor = LintVisitor::new(wdl::lint::rules().into_iter().filter_map(|rule| {
if except_rules.contains(&rule.id().to_string()) {
None
} else {
Some(rule)
}
}
Err(diagnostics) => {
reporter.emit_diagnostics(file, &diagnostics)?;
syntax_failure = true;
}));
linter.add_visitor(visitor);
if let Err(diagnostic) = linter.validate(&document) {
reporter.emit_diagnostics(file, &diagnostic)?;
lint_failure = true;
}
}
}
Expand Down

0 comments on commit b3e4679

Please sign in to comment.