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

Add lint warning for tools with cores and no mem #140

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

natefoo
Copy link
Member

@natefoo natefoo commented Oct 31, 2024

Related discussion in galaxyproject/tpv-shared-database#73.

I looked a bit at adding #noqa support but reading comments and figuring out the line they are associated with seemed a bit tricky. But if it's something we want I could work on that. Alternatively, tpv lint --ignore=... to simply ignore an entire class of warnings would be easy to implement, but then it's all-or-nothing.
I went ahead and added # noqa and command line tpv lint --ignore=... support. # noqa comments apply to the whole entity they are contained within and can either be without a specific code (in which case all warnings are ignored) or can specify codes as a comma-separated list like # noqa: T101, T102, .... Inline # noqa comments are not supported.

IMO you'd probably not want these warnings on your local TPV config, but we probably do want them on the shared DB.

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 11673159985

Details

  • 67 of 70 (95.71%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.3%) to 95.372%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tpv/core/loader.py 33 36 91.67%
Totals Coverage Status
Change from base Build 10706773089: -0.3%
Covered Lines: 1061
Relevant Lines: 1092

💛 - Coveralls

Copy link
Member

@nuwang nuwang left a comment

Choose a reason for hiding this comment

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

This looks great, thanks @natefoo! I think it should finally take away all those spurious warnings.

This might be a bit hairy to merge with: https://github.com/galaxyproject/total-perspective-vortex/pull/136/files but that's on me - I still need to enhance the linter to use that PR, and check types.

def load_yaml_from_url_or_path(url_or_path: str):
yaml = ruamel.yaml.YAML(typ='safe')
def load_yaml_from_url_or_path(url_or_path: str, round_trip: bool = False):
typ = "rt" if round_trip else "safe"
Copy link
Member

Choose a reason for hiding this comment

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

Can we simplify this to make it roundtrip always? Is there a disadvantage?

Copy link
Member Author

Choose a reason for hiding this comment

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

With safe the data loads as plain Python objects (e.g. dicts and lists) and changing the loader to rt makes them CommentedMap, CommentedList, etc. Since only the linter needs round trip it this felt safer to me not knowing the code very well, but if you don't think it would cause problems I'm happy to change it to always load round trip.

Copy link
Member Author

Choose a reason for hiding this comment

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

Regarding a disadvantage, if all the data are copied from the loader Entity objects (and not by copying the ref to the loader object representation) then it's probably ok. If not, it could potentially increase memory usage slightly and I am not certain everything would merge the same way without digging into ruamel.yaml.

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.

3 participants