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
feat: document_preamble lint rule #25
base: main
Are you sure you want to change the base?
feat: document_preamble lint rule #25
Conversation
break; | ||
} | ||
_ => { | ||
anything_else += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be unreachable!()
? When could something other than COMMENT
or WHITESPACE
be found before version
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought so, so I changed it. However, it broke a bunch of other tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the lints are being run as part of some of the other tests, e.g.
fn it_parses_from_a_supported_node_type() { |
version
declaration. I'm not sure if the lints should be running, I would have thought not. Maybe @claymcleod can weigh in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, for individual tests, the lints can be disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not clear how they're being run (or how to disable, if that's what should happen). It's when I run cargo test --all-features
, but it produces a long list of failures, most of which are it_parses_from_a_supported_node_type
type tests.
v1::document::declaration::bound::tests::it_parses_from_a_supported_node_type
v1::document::declaration::unbound::tests::it_parses_from_a_supported_node_type
v1::document::expression::array::tests::it_parses_from_a_supported_node_type
v1::document::expression::map::tests::it_parses_from_a_supported_node_type
v1::document::expression::pair::tests::it_parses_from_a_supported_node_type
v1::document::expression::r#if::tests::it_parses_from_a_supported_node_type
v1::document::expression::tests::ensure_number_works_correctly
v1::document::expression::tests::it_correctly_parses_floats
v1::document::expression::tests::it_ignores_comments_and_whitespace
v1::document::identifier::qualified::tests::it_parses_from_a_supported_node_type
v1::document::identifier::tests::it_parses_from_a_supported_node_type
v1::document::import::tests::it_parses_a_complicated_import_correctly
v1::document::output::builder::tests::it_parses_from_a_supported_node_type
v1::document::private_declarations::tests::it_parses_from_a_supported_node_type
v1::document::r#struct::tests::it_parses_from_a_supported_node_type
v1::document::task::runtime::value::tests::it_correctly_parses_floats
v1::document::task::runtime::value::tests::it_correctly_parses_integers
v1::document::tests::it_parses_from_a_supported_node_type
v1::document::workflow::execution::statement::call::body::tests::it_parses_from_a_supported_node_type
v1::document::workflow::execution::statement::call::tests::it_parses_from_a_supported_node_type
v1::document::workflow::execution::statement::conditional::tests::it_parses_from_a_supported_node_type
v1::document::workflow::execution::statement::scatter::tests::it_parses_from_a_supported_node_type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. It's here in parse_rule
.
Lines 177 to 179 in 35731ec
if let Some(warnings) = Linter::lint(&pt, lint::rules()).map_err(Error::Lint)? { | |
for warning in warnings { | |
concerns = concerns.push(Concern::LintWarning(warning)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a way to disable running the lint rules in that function. It does appear that nothing is done with any lint warnings. Was this intentional?
This pull request adds a new rule to
wdl
.document_preamble
v1::W009
wdl-grammar
Implements document_preamble as defined in #11.
Before submitting this PR, please make sure:
CHANGELOG.md
(see["keep a changelog"] for more information).
good, articulated reason as to why there shouldn be more than one).
Rule specific checks:
tables (
wdl-ast/src/v1.rs
for AST-based rules andwdl-grammar/src/v1.rs
for parse tree-based rules).table at
RULES.md
.fn rules()
.wdl-ast
should be added tofn rules()
withinwdl-ast/src/v1/validation.rs
.wdl-ast
should be added tofn rules()
withinwdl-ast/src/v1/lint.rs
.wdl-grammar
should be added tofn rules()
withinwdl-grammar/src/v1/validation.rs
.wdl-grammar
should be added tofn rules()
withinwdl-grammar/src/v1/lint.rs
.within the file where the rule is implemented.
wdl-gauntlet --save-config
to ensure that all of the rulesadded/removed are now reflected in the baseline configuration file
(
Gauntlet.toml
).