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
Automatically detect implementation languages on GitHub #1203
Conversation
If a project is created, and its repo is on GitHub, use the GitHub API to discover the implementation languages in use and fill in that information. This required updating several vcr_cassettes. Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
Codecov Report
@@ Coverage Diff @@
## master #1203 +/- ##
======================================
Coverage 100% 100%
======================================
Files 47 47
Lines 1684 1693 +9
======================================
+ Hits 1684 1693 +9
Continue to review full report at Codecov.
|
:"C#" => 29_834, | ||
HTML: 2_290, | ||
Ruby: 1_359 | ||
) |
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 seems like a bad thing to build into a test, since the values will change the next time the cassette is re-recorded, right?
Could you instead run on a known value that won't change, like the values of a specific release: https://github.com/kubernetes/kubernetes/tree/release-1.0
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.
Oh wait - these values will not change when the cassette is re-recorded. The hash value here is sent to a specific method which reformats them from a string - it doesn't retrieve anything from GitHub. The JSON values here were originally from assimilation, but I just used those because it's a real-world complicated list. So it turns out that it's not a problem here!
LGTM if you address my one comment. |
I'm not sure fixing the version is better. I'd like the test to be like the real thing as much as possible. I think it is highly unlikely for these values to change anyway; if they do, we can change the values to match. Also, the mismatch can only occur when we recompute cassettes, which is rare. |
Fixing the version to analyze does not relly fix the results anyway; this is a service request, and GitHub sometimes updates the heuristics used in their analysis to determine languages. |
Simplest would be for ciitest to fork a repo (like the best practices one) and then not change it. That should be relatively stable. |
Yes, I think that's the better approach. Then the test will be more realistic. Changes could still happen, but they would be at least relatively rare. |
OK, please merge then.
…--
Dan Kohn <dan@linuxfoundation.org>
Executive Director, Cloud Native Computing Foundation https://www.cncf.io
+1-415-233-1000 https://www.dankohn.com
On Sun, Aug 5, 2018 at 11:21 PM, ciitest ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In test/unit/lib/github_basic_detective_test.rb
<#1203 (comment)>
:
> + assert_equal 'C#, JavaScript', detective.language_cleanup(
+ HTML: 1000, :"C#" => 5000, JavaScript: 800
+ )
+ # This is the list from https://api.github.com/repos/
+ # assimilation/assimilation-official/languages
+ assert_equal 'Python, C, Shell, C++, CMake, C#, Ruby',
+ detective.language_cleanup(
+ Python: 1_151_127,
+ C: 1_059_779,
+ Shell: 285_358,
+ :"C++" => 44_086,
+ CMake: 33_855,
+ :"C#" => 29_834,
+ HTML: 2_290,
+ Ruby: 1_359
+ )
Oh wait - these values will *not* change when the cassette is
re-recorded. The hash value here is sent to a specific method which
reformats them from a string - it doesn't retrieve anything from GitHub.
The JSON values here were originally from assimilation, but I just used
those because it's a real-world complicated list. So it turns out that it's
not a problem here!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1203 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AC8MBlV7s6fC-0XWNsWdfENoQKFoAsc2ks5uN7YpgaJpZM4Vu6Y0>
.
|
That test already uses some data from a ciitest project, but it didn't test the detected languages - because there weren't any!! I have added a Python file to the ciitest project, so we can have a more realistic test, and keeps the unit tests that try out other options. I'll push that version up soon. So that resolves everything. Thanks! |
This adds a direct test of the detected implementation languages for the simple ciitest test project. Signed-off-by: David A. Wheeler <dwheeler@dwheeler.com>
If a project is created, and its repo is on GitHub, use the
GitHub API to discover the implementation languages in use
and fill in that information. This required updating
several vcr_cassettes.
Signed-off-by: David A. Wheeler dwheeler@dwheeler.com