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

[22.05] Fix assertion linting to not fail on byte suffixes #15873

Merged

Conversation

bernt-matthias
Copy link
Contributor

fails for instance here: galaxyproject/tools-iuc#5223

The linter checked the type annotations of the assertion function. Since the type annotation was wrong (int does not allow for bytes .. and the functions get str from the xml attribues anyway) linting fails. I would suggest to remove the test .. also because its still covered by the xsd linter.

I could move the 2nd commit to a separate PR.

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

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

n, min, max, ... accept bytes (eg 500k)

i.e. the type annotation and thereby linting was wrong
I suggest to remove it, since its tested in the xsd linter
anyway (otherwise we would check for str)
the functions always get a str (from the xml attributes)
min: Optional[int] = None,
max: Optional[int] = None,
negate: bool = False,
n: Optional[str] = None,
Copy link
Member

Choose a reason for hiding this comment

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

Only when coming from the XML right? YAML tools, workflow tests, etc... will be properly typed I imagine. I would use Union types to capture this if it is important to lose the typing for XML.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah - this feels like you're throwing out a lot of good stuff to support a kind of edge case. Can you just update the size parameter to have a union type and make sure the annotation check is skipping complex types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will try.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Have added bool/int to the parameters in addition to str.

I'm not sure about the code that I removed from the linting code. Since this is only for xml I'm unsure if its really needed. Feels a bit redundant with the xsd linter. Also for xml we will always have str .. so I don't see this failing in any case.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any thoughts on this @jmchilton ? Test failures seem unrelated.

@mvdbeek mvdbeek merged commit 012102d into galaxyproject:release_22.05 May 9, 2023
31 of 36 checks passed
@github-actions
Copy link

github-actions bot commented May 9, 2023

This PR was merged without a "kind/" label, please correct.

@mvdbeek mvdbeek changed the title [22.05] fix linter for assertions (which need to allow for byte suffixes) [22.05] Fix assertion linting to not fail on byte suffixes May 24, 2023
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.

None yet

3 participants