Skip to content

Commit

Permalink
feat: adds wdl-grammar gauntlet for testing grammar parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
claymcleod committed Nov 13, 2023
1 parent b713131 commit 0c92cfd
Show file tree
Hide file tree
Showing 35 changed files with 4,827 additions and 876 deletions.
1,970 changes: 1,849 additions & 121 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ license = "MIT OR Apache-2.0"
edition = "2021"

[workspace.dependencies]
clap = { version = "4.4.7", features = ["derive"] }
env_logger = "0.10.0"
indexmap = { version = "2.1.0", features = ["serde"] }
log = "0.4.20"
pest = { version = "2.7.5", features = ["pretty-print"] }
pest_derive = "2.7.5"
serde = { version = "1", features = ["derive"] }
serde_with = { version = "3.4.0" }
toml = "0.8.8"
47 changes: 47 additions & 0 deletions Gauntlet.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version = "v1"

[[repositories]]
organization = "PacificBiosciences"
name = "HiFi-human-WGS-WDL"

[[repositories]]
organization = "biowdl"
name = "tasks"

[[repositories]]
organization = "stjudecloud"
name = "workflows"

[[repositories]]
organization = "chanzuckerberg"
name = "czid-workflows"

[[ignored_errors]]
document = "biowdl/tasks:bedtools.wdl"
error = """
--> 29:67
|
29 | String memory = \"~{512 + ceil(size([inputBed, faidx], \"MiB\"))}MiB\"
| ^---
|
= expected WHITESPACE or OPTION"""

[[ignored_errors]]
document = "biowdl/tasks:bowtie.wdl"
error = """
--> 40:58
|
40 | String memory = \"~{5 + ceil(size(indexFiles, \"GiB\"))}GiB\"
| ^---
|
= expected WHITESPACE or OPTION"""

[[ignored_errors]]
document = "stjudecloud/workflows:template/task-templates.wdl"
error = """
--> 17:25
|
17 | Int memory_gb = <>
| ^---
|
= expected WHITESPACE, COMMENT, or expression"""
44 changes: 38 additions & 6 deletions wdl-grammar/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,41 @@ edition.workspace = true
license.workspace = true

[dependencies]
clap = { version = "4.4.6", features = ["derive"] }
env_logger.workspace = true
log.workspace = true
pest = "2.7.5"
pest_derive = "2.7.5"
serde.workspace = true
async-recursion = { version = "1.0.5", optional = true }
chrono = { version = "0.4.31", optional = true }
clap = { workspace = true, optional = true }
colored = { version = "2.0.4", optional = true }
dirs = { version = "5.0.1", optional = true }
env_logger = { workspace = true, optional = true }
indexmap = { workspace = true, optional = true }
log = { workspace = true, optional = true }
octocrab = { version = "0.32.0", optional = true }
pest = { workspace = true }
pest_derive = { workspace = true }
reqwest = { version = "0.11.22", optional = true }
serde = { workspace = true }
serde_with = { workspace = true, optional = true }
tokio = { version = "1.33.0", features = ["full"], optional = true}
toml = { workspace = true, optional = true }

[features]
binaries = [
"async-recursion",
"chrono",
"clap",
"colored",
"dirs",
"env_logger",
"indexmap",
"log",
"octocrab",
"reqwest",
"serde_with",
"tokio",
"toml"
]

[[bin]]
name = "wdl-grammar"
path = "src/main.rs"
required-features = ["binaries"]
146 changes: 0 additions & 146 deletions wdl-grammar/src/bin/wdl-grammar-create-test.rs

This file was deleted.

38 changes: 38 additions & 0 deletions wdl-grammar/src/commands.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//! Subcommands for the `wdl-grammar` command-line tool.
use log::debug;

pub mod create_test;
pub mod gauntlet;
pub mod parse;

/// An error common to any subcommand.
#[derive(Debug)]
pub enum Error {
/// An input/output error.
InputOutput(std::io::Error),
}

impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Error::InputOutput(err) => write!(f, "i/o error: {err}"),
}
}
}

impl std::error::Error for Error {}

/// A [`Result`](std::result::Result) with an [`Error`].
type Result<T> = std::result::Result<T, Error>;

/// Gets lines of input from STDIN.
pub fn get_contents_stdin() -> Result<String> {
debug!("Reading from STDIN...");

Ok(std::io::stdin()
.lines()
.collect::<std::result::Result<Vec<_>, _>>()
.map_err(Error::InputOutput)?
.join("\n"))
}
Loading

0 comments on commit 0c92cfd

Please sign in to comment.