-
Notifications
You must be signed in to change notification settings - Fork 7
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: add check for proper snake_case usage #13
Closed
Closed
Conversation
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
claymcleod
requested changes
Apr 18, 2024
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 this looks really good! Looking at the results of the discussion above, I think this is probably going to be a fine baseline rule that we modify over time. As such, I gave some (rather picky) thoughts here.
11 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds a new rule to
wdl-grammar
.snake_case
v1::W006
wdl-grammar
Describe the rules you have implemented and link to any relevant issues.
This rule enforces snake case on workflows, tasks and variables names.
I had to modify other parts of the project to create this PR :
to_snake_case
crate to theconvert_case
crate that will handle the same task (and more once the PascalCase rule gets implemented)task_name
rule to mirror theworkflow_name
rule. This allows for a cleaner identification of the task names for this lint rule.This rule has been created with an Array of rules to check which should be snake cased. This is to enable potential opt-in or opt-out of the various elements from the snake_case and PascalCase rules.
One caveat is that this rule does not check the imports (can we properly type them to differentiate the
struct
from the rest?)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.