-
Notifications
You must be signed in to change notification settings - Fork 12
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
base: main
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 11673159985Details
💛 - Coveralls |
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.
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" |
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.
Can we simplify this to make it roundtrip
always? Is there a disadvantage?
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.
With safe
the data loads as plain Python objects (e.g. dict
s and list
s) 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.
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.
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.
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 linetpv 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.