-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Added support for new Code Climate scores #1236
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4abadf0
Added support for new Code Climate scores
Nickersoft 96d1c97
1) Changed /tc/ to /c/
Nickersoft 5f67ecf
Pushed failing tests
Nickersoft 323cacd
Switch to https
paulmelnikow 1945b7e
Add missing mock for first call
paulmelnikow f8ca682
Merge pull request #1 from paulmelnikow/pr-1236
Nickersoft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
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
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
'use strict'; | ||
|
||
const Joi = require('joi'); | ||
const ServiceTester = require('./runner/service-tester'); | ||
|
||
const t = new ServiceTester({ id: 'codeclimate', title: 'Code Climate' }) | ||
|
||
t.create('maintainability score') | ||
.get('/maintainability/Nickersoft/dql.json') | ||
.expectJSONTypes(Joi.object().keys({ | ||
name: 'maintainability', | ||
value: Joi.equal('A', 'B', 'C', 'D', 'F', 'unknown') | ||
})); | ||
|
||
t.create('maintainability score for non-existent repo') | ||
.get('/maintainability/unknown/unknown.json') | ||
.expectJSON({ | ||
name: 'maintainability', | ||
value: 'not found' | ||
}); | ||
|
||
t.create('maintainability score without content-disposition') | ||
.get('/maintainability/Nickersoft/dql.json') | ||
.intercept(nock => nock('https://api.codeclimate.com') | ||
.get('/v1/repos') | ||
.query({ github_slug: 'Nickersoft/dql' }) | ||
.reply(200, { data: [{ attributes: { badge_token: '78ac0fa85c83fea5213a' } }] }) | ||
.head('/v1/badges/78ac0fa85c83fea5213a/maintainability') | ||
.reply(200)) | ||
.expectJSON({ name: 'maintainability', value: 'invalid' }); | ||
|
||
t.create('test coverage score') | ||
.get('/c/Nickersoft/dql.json') | ||
.expectJSONTypes(Joi.object().keys({ | ||
name: 'coverage', | ||
value: Joi.equal('A', 'B', 'C', 'D', 'F', 'unknown') | ||
})); | ||
|
||
t.create('test coverage score for non-existent repo') | ||
.get('/c/unknown/unknown.json') | ||
.expectJSON({ | ||
name: 'coverage', | ||
value: 'not found' | ||
}); | ||
|
||
t.create('test coverage score without content-disposition') | ||
.get('/c/Nickersoft/dql.json') | ||
.intercept(nock => nock('https://api.codeclimate.com') | ||
.get('/v1/repos') | ||
.query({ github_slug: 'Nickersoft/dql' }) | ||
.reply(200, { data: [{ attributes: { badge_token: '78ac0fa85c83fea5213a' } }] }) | ||
.head('/v1/badges/78ac0fa85c83fea5213a/test_coverage') | ||
.reply(200)) | ||
.expectJSON({ name: 'coverage', value: 'invalid' }); | ||
|
||
|
||
module.exports = t; |
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.
Is this the "project not found" case? Is it possible to test that more explicitly above, so you can reserve the
catch
for "something went wrong" and return invalid instead of not found?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 not exactly sure... I copied these code blocks from the existing CodeClimate blocks. Could you elaborate on when "not found" vs. "invalid" vs. "unknown" should be displayed?
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.
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.
Ah, I gotcha. I tried to fixed the errors to be more appropriate, so take a look when you can.