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

Integrate Tool Parameter Modeling into Linting (for Planemo) #19073

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

jmchilton
Copy link
Member

Builds on #19027 - only the last commit is adding functionality beyond that.

Adds two new linters so far. One runs the test case validation added in #18679. So basically it indicates if the tool test case are already passing the best practices required for profile 24.2 tools - allowing disambiguation and stronger typing. The other linter builds assertion models for the outputs and runs them against the Pydantic validators added in #18787. There is a test case added the shows this provides checks beyond the XSD.

The way I originally defined the linting levels - errors would prevent the tool from loading. The test linting added since then by others have recorded a bunch of test case issues as errors instead of warnings - I stuck by my original classification but maybe the assertion problems should be errors the way things have drifted?

The pydantic errors are an unfortunate combination of much wordier and less precise than the existing linters (all the context is stripped out - what output, what line number, etc...) so I'm contemplating hiding some of the output behind a verbose flag.

How to test the changes?

(Select all options that apply)

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

Copy link
Contributor

@bernt-matthias bernt-matthias left a comment

Choose a reason for hiding this comment

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

Super cool. Haven't had time yet to have a more detailed look.

except Exception as e:
error_str = _cleanup_pydantic_error(e)
lint_ctx.warn(
f"Test {test_idx}: failed to validate assertions. Validation errors are [{error_str}]"
Copy link
Contributor

Choose a reason for hiding this comment

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

When I rewrote the linter stuff my idea was that each linter class can emit only one message, i.e. there should be only one call to lint_ctx.... per class.

Then we can easily enable / disable specific messages. Downside is that the code gets a bit awkward in a few places. Still, maybe we should stick to that scheme?

Copy link
Member Author

Choose a reason for hiding this comment

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

The existing class TestsExpectNumOutputs outputs one message per test index. This does the same thing. Is that the problem or is the problem the warning on the parse error - because I return after that and so it should only output one message for the tool.

@jmchilton jmchilton marked this pull request as ready for review November 4, 2024 17:52
@github-actions github-actions bot added this to the 24.2 milestone Nov 4, 2024
@jdavcs jdavcs merged commit e5635dc into galaxyproject:dev Nov 5, 2024
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants