kopia lustrzana https://github.com/badgen/badgen.net
feat: migrate /codeclimate (#614)
rodzic
356fb58ff1
commit
b4487415f8
|
@ -41,7 +41,6 @@ export const liveBadgeList = [
|
|||
'codecov',
|
||||
'codacy',
|
||||
'coveralls',
|
||||
'codeclimate',
|
||||
'azure-pipelines',
|
||||
// quality & metrics
|
||||
'snyk',
|
||||
|
|
|
@ -3,6 +3,7 @@ import github from '../pages/api/github'
|
|||
import npm from '../pages/api/npm'
|
||||
import bundlephobia from '../pages/api/bundlephobia'
|
||||
import packagephobia from '../pages/api/packagephobia'
|
||||
import codeclimate from '../pages/api/codeclimate'
|
||||
import chromeWebStore from '../pages/api/chrome-web-store'
|
||||
import hackage from '../pages/api/hackage'
|
||||
import pypi from '../pages/api/pypi'
|
||||
|
@ -16,6 +17,7 @@ export default {
|
|||
npm: npm.meta,
|
||||
bundlephobia: bundlephobia.meta,
|
||||
packagephobia: packagephobia.meta,
|
||||
codeclimate: codeclimate.meta,
|
||||
'chrome-web-store': chromeWebStore.meta,
|
||||
hackage: hackage.meta,
|
||||
pypi: pypi.meta,
|
||||
|
|
|
@ -46,6 +46,7 @@ const nextConfig = {
|
|||
'/npm',
|
||||
'/bundlephobia',
|
||||
'/packagephobia',
|
||||
'/codeclimate',
|
||||
'/chrome-web-store',
|
||||
'/hackage',
|
||||
'/ppm',
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
import got from '../libs/got'
|
||||
import { coverage as cov, scale } from '../libs/utils'
|
||||
import { createBadgenHandler, PathArgs } from '../libs/create-badgen-handler'
|
||||
import got from '../../libs/got'
|
||||
import { coverage as cov, scale } from '../../libs/utils'
|
||||
import { createBadgenHandler, PathArgs } from '../../libs/create-badgen-handler-next'
|
||||
import type { BadgenParams } from '../../libs/types'
|
||||
|
||||
|
||||
|
||||
export default createBadgenHandler({
|
||||
title: 'Code Climate',
|
||||
|
@ -18,7 +21,7 @@ export default createBadgenHandler({
|
|||
}
|
||||
})
|
||||
|
||||
async function handler ({ topic, owner, repo }: PathArgs) {
|
||||
async function handler ({ topic, owner, repo }: PathArgs): Promise<BadgenParams> {
|
||||
const api = `https://api.codeclimate.com/v1/repos?github_slug=${owner}/${repo}`
|
||||
const result = await got(api).json<any>()
|
||||
const meta = result.data[0]
|
||||
|
@ -105,6 +108,12 @@ const getReport = async (repoId, reportId, type, topic) => {
|
|||
status: cov(attributes.rating.measure.value),
|
||||
color: scale('coverage')(attributes.rating.measure.value)
|
||||
}
|
||||
default:
|
||||
return {
|
||||
subject: 'codeclimate',
|
||||
status: 'unknown topic',
|
||||
color: 'gray'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -30,10 +30,6 @@
|
|||
"source": "/codacy/:match*",
|
||||
"destination": "https://v2022.badgen.net/codacy/:match*"
|
||||
},
|
||||
{
|
||||
"source": "/codeclimate/:match*",
|
||||
"destination": "https://v2022.badgen.net/codeclimate/:match*"
|
||||
},
|
||||
{
|
||||
"source": "/codecov/:match*",
|
||||
"destination": "https://v2022.badgen.net/codecov/:match*"
|
||||
|
|
Ładowanie…
Reference in New Issue