-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implements the
container_value
lint rule
- Loading branch information
1 parent
6faf7db
commit 00bae84
Showing
33 changed files
with
3,147 additions
and
64 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//! Prints `requirements` keys from the first task in a WDL document. | ||
use wdl_ast::AstToken; | ||
use wdl_ast::Document; | ||
|
||
fn main() { | ||
let path = std::env::args().nth(1).expect("missing path"); | ||
let contents = std::fs::read_to_string(path).expect("file to be readable to string"); | ||
|
||
let (document, diagnostics) = Document::parse(&contents); | ||
|
||
if !diagnostics.is_empty() { | ||
eprintln!( | ||
"warning: {n} diagnostics were detected, this may affect results", | ||
n = diagnostics.len() | ||
) | ||
} | ||
|
||
let task = document | ||
.ast() | ||
// SAFETY: only V1 ASTs are supported for this example at present. | ||
.unwrap_v1() | ||
.tasks() | ||
.next() | ||
// SAFETY: we expect the document to contain at least one task for this example | ||
// to work correctly. | ||
.expect("document to contain at least one task"); | ||
|
||
let requirements = task.requirements().next().unwrap_or_else(|| { | ||
panic!( | ||
"a `requirements` section to be present in task {name}", | ||
name = task.name().syntax() | ||
) | ||
}); | ||
|
||
if let Some(container) = requirements.container() { | ||
println!("{:?}", container); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//! Prints `runtime` keys from the first task in a WDL document. | ||
use wdl_ast::AstToken; | ||
use wdl_ast::Document; | ||
|
||
fn main() { | ||
let path = std::env::args().nth(1).expect("missing path"); | ||
let contents = std::fs::read_to_string(path).expect("file to be readable to string"); | ||
|
||
let (document, diagnostics) = Document::parse(&contents); | ||
|
||
if !diagnostics.is_empty() { | ||
eprintln!( | ||
"warning: {n} diagnostics were detected, this may affect results", | ||
n = diagnostics.len() | ||
) | ||
} | ||
|
||
let task = document | ||
.ast() | ||
// SAFETY: only V1 ASTs are supported for this example at present. | ||
.unwrap_v1() | ||
.tasks() | ||
.next() | ||
// SAFETY: we expect the document to contain at least one task for this example | ||
// to work correctly. | ||
.expect("document to contain at least one task"); | ||
|
||
let runtime = task.runtimes().next().unwrap_or_else(|| { | ||
panic!( | ||
"a `runtime` section to be present in task {name}", | ||
name = task.name().syntax() | ||
) | ||
}); | ||
|
||
if let Some(container) = runtime.container() { | ||
println!("{:?}", container); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.