Skip to content
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: implements the container_value rule #142

Merged
merged 1 commit into from
Aug 5, 2024
Merged

Conversation

claymcleod
Copy link
Member

@claymcleod claymcleod commented Jul 25, 2024

This pull request adds a new rule to wdl-lint.

  • Rule Name: ContainerValue

This rule is intended to implement the mutable_container and immutable_container_not_tagged baseline lint rules (link). In so doing, it was an exploration in implementing various wrappers within the AST that were built from existing AST nodes (rather than cast from SyntaxNodes). I also added in a few checks related to cointainers that seemed logical to me, namely:

  • container arrays with zero elements are ambiguous and should be replaced with something concrete.
  • container arrays with one element should be replaced with a single, literal string.
  • container arrays with the special 'any' container designator (*) are ambiguous, as you're both indicating that a set of specific containers should be used and that any container can be used. As such, it should be avoided.

Additionally, I fixed a small bug ("oversight"?) I discovered in the MissingRuntime lint while developing this: MissingRuntime should only be flagging things for WDL v1.1 or earlier, as the runtime section was deprecated in favor of requirements in WDL v1.2.

Before submitting this PR, please make sure:

  • You have added a few sentences describing the PR here.
  • You have added yourself or the appropriate individual as the assignee.
  • You have added at least one relevant code reviewer to the PR.
  • Your code builds clean without any errors or warnings.
  • You have added an entry to the relevant CHANGELOG.md (see
    "keep a changelog" for more information).
  • Your commit messages follow the conventional commit style.

Rule specific checks:

  • You have added the rule as an entry within RULES.md.
  • You have added the rule to the rules() function in wdl-lint/src/lib.rs.
  • You have added a test case in wdl-lint/tests/lints that covers every
    possible diagnostic emitted for the rule within the file where the rule
    is implemented.
  • If you have implemented a new Visitor callback, you have also
    overridden that callback method for the special Validator
    (wdl-ast/src/validation.rs) and LintVisitor
    (wdl-lint/src/visitor.rs) visitors. These are required to ensure the new
    visitor callback will execute.
  • You have run wdl-gauntlet --refresh to ensure that there are no
    unintended changes to the baseline configuration file (Gauntlet.toml).
  • You have run wdl-gauntlet --refresh --arena to ensure that all of the
    rules added/removed are now reflected in the baseline configuration file
    (Arena.toml).

@claymcleod claymcleod force-pushed the feat/container-tags branch 5 times, most recently from ed91471 to 46840ec Compare July 26, 2024 04:38
@claymcleod claymcleod self-assigned this Jul 26, 2024
@claymcleod claymcleod force-pushed the feat/container-tags branch 2 times, most recently from a04faec to 57f7a5f Compare July 26, 2024 14:06
@claymcleod claymcleod force-pushed the feat/container-tags branch from 57f7a5f to 8fbe20a Compare July 26, 2024 14:10
@claymcleod claymcleod marked this pull request as ready for review July 26, 2024 14:10
@claymcleod claymcleod force-pushed the feat/container-tags branch 2 times, most recently from 478ec47 to ae11841 Compare July 26, 2024 14:18
@claymcleod claymcleod force-pushed the feat/container-tags branch 2 times, most recently from 21955bb to 6b6b4c1 Compare July 26, 2024 14:27
@claymcleod claymcleod force-pushed the feat/container-tags branch 2 times, most recently from 00bae84 to 4b70d97 Compare July 26, 2024 14:36
Arena.toml Outdated Show resolved Hide resolved
wdl-ast/examples/explore_requirements.rs Outdated Show resolved Hide resolved
wdl-ast/examples/explore_runtime.rs Outdated Show resolved Hide resolved
wdl-ast/src/v1/task/common/container/value.rs Show resolved Hide resolved
wdl-lint/src/rules/container_value.rs Outdated Show resolved Hide resolved
wdl-lint/src/rules/container_value.rs Show resolved Hide resolved
Copy link
Member Author

@claymcleod claymcleod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be ready for review again.

Copy link
Member

@adthrasher adthrasher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, pending @a-frantz's comments.

@claymcleod claymcleod force-pushed the feat/container-tags branch from 427f06b to e5714f0 Compare August 5, 2024 14:08
@claymcleod claymcleod merged commit da8b7e6 into main Aug 5, 2024
8 checks passed
@claymcleod claymcleod deleted the feat/container-tags branch August 5, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants