-
Notifications
You must be signed in to change notification settings - Fork 23
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 linting and formatting to linkml-runtime #347
Open
sneakers-the-rat
wants to merge
18
commits into
linkml:main
Choose a base branch
from
sneakers-the-rat:ruff-linting
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+14,188
−8,573
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… bunch of actually used imports
…cation warning we actually have no way of keeping track of that.
cmungall
approved these changes
Oct 31, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Builds on: #345
The non-modular PR is because the changes to update to 3.9 use the linting rules we're implementing here.
This sets us up with
linkml
UP
- pyupgrade with an override forX | Y
types until 3.9 gets droppedT100
- nopdb
imports or uses (i am guilty of this a lot)I punted on a handful of rules for the
tests
module because there are a lot of violations and it's just in tests, those are mostly assigned values that aren't used, which are fine in tests if a little implicit.Bigass diff, i'm aware, but that's why we add the linter rules, so future diffs are smaller :)
Review spots
To help out review, all the changes here are linter fixes with no functional change except:
linkml_runtime.utils.metamodelcore
- There were a handful of invalid error handling blocks that looked like this:And that isn't valid because
e
is undefined. It's also ambiguous whether or not those values should always pass, and we raise on any other error, or whether we raise those errors if in strict mode. I assumed the latter, so i changed that tolinkml_runtime.loaders.rdf_loader
- there's a reference topyld_jsonld_from_rdflib_graph
and i'm not sure what that is, can't find it anywhere. so i marked itnoqa
linkml_runtime.utils.permissiblevalueimpl:PvFormulaOptions
has a default value that usesEnumDefinition
. That would make a pretty nasty dependency loop if we fixed it, so i just commented it out. This prevented the module from being imported at all, so i suspect this is deprecated.tests.__init__.py
used aneval
call to get a log level, usingeval
that should basically never be done, so i switched it togetattr