-
Notifications
You must be signed in to change notification settings - Fork 926
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
Instrument Python version metric #7617
Merged
Merged
Changes from 3 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,28 @@ def self.required_files_message | |
"or a Pipfile." | ||
end | ||
|
||
def ecosystem_versions | ||
# Hmm... it's weird that this calls file parser methods, but here we are in the file fetcher... for all | ||
# ecosystems our goal is to extract the user specified versions, so we'll need to do file parsing... so should | ||
# we move this `ecosystem_versions` metrics method to run in the file parser for all ecosystems? Downside is if | ||
# file parsing blows up, this metric isn't emitted, but reality is we have to parse anyway... as we want to know | ||
# the user-specified range of versions, not the version Dependabot chose to run. | ||
python_requirement_parser = FileParser::PythonRequirementParser.new(dependency_files: files) | ||
language_version_manager = LanguageVersionManager.new(python_requirement_parser: python_requirement_parser) | ||
{ | ||
languages: { | ||
python: { | ||
# TODO: alternatively this could use `python_requirement_parser.user_specified_requirements` which | ||
# returns an array... which we could flip to return a hash of manifest name => version | ||
# string and then check for min/max versions... today it simply defaults to | ||
# array.first which seems rather arbitrary. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
"raw" => language_version_manager.user_specified_python_version || "unknown", | ||
"max" => language_version_manager.python_major_minor || "unknown" | ||
} | ||
} | ||
} | ||
end | ||
|
||
private | ||
|
||
def fetch_files | ||
|
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.
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.
I'm planning to have follow-on PR's that move this to the
FileParser
class, but that refactor will require more work, and want this live now so it starts collecting metrics, so I'm going to merge as-is and then clean it up.