Use route patterns in [snap-ci nsp gratipay githubmanifest codacy cauditor bithound] (#3327)

Ref #3329
This commit is contained in:
Paul Melnikow
2019-04-18 18:15:48 -05:00
committed by GitHub
parent 066193c002
commit b069dbbaad
9 changed files with 13 additions and 16 deletions

View File

@@ -6,7 +6,7 @@ module.exports = deprecatedService({
category: 'dependencies',
route: {
base: 'bithound',
format: '(?:code/|dependencies/|devDependencies/)?(?:.+?)',
pattern: ':various*',
},
label: 'bithound',
dateAdded: new Date('2018-07-08'),

View File

@@ -6,7 +6,7 @@ module.exports = deprecatedService({
category: 'other',
route: {
base: 'cauditor',
format: '(?:mi|ccn|npath|hi|i|ca|ce|dit)/(?:[^/]+)/(?:[^/]+)/(?:.+)',
pattern: ':various*',
},
label: 'cauditor',
dateAdded: new Date('2018-02-15'),

View File

@@ -21,8 +21,7 @@ module.exports = class CodacyCoverage extends BaseSvgScrapingService {
static get route() {
return {
base: 'codacy/coverage',
format: '(?!grade/)([^/]+)(?:/(.+))?',
capture: ['projectId', 'branch'],
pattern: ':projectId/:branch*',
}
}

View File

@@ -14,8 +14,7 @@ module.exports = class CodacyGrade extends BaseSvgScrapingService {
static get route() {
return {
base: 'codacy/grade',
format: '(?:grade/)?(?!coverage/)([^/]+)(?:/(.+))?',
capture: ['projectId', 'branch'],
pattern: ':projectId/:branch*',
}
}

View File

@@ -4,21 +4,21 @@ const t = (module.exports = require('../tester').createServiceTester())
const { codacyGrade } = require('./codacy-helpers')
t.create('Code quality')
.get('/grade/e27821fb6289410b8f58338c7e0bc686.json')
.get('/e27821fb6289410b8f58338c7e0bc686.json')
.expectBadge({
label: 'code quality',
message: codacyGrade,
})
t.create('Code quality on branch')
.get('/grade/e27821fb6289410b8f58338c7e0bc686/master.json')
.get('/e27821fb6289410b8f58338c7e0bc686/master.json')
.expectBadge({
label: 'code quality',
message: codacyGrade,
})
t.create('Code quality (package not found)')
.get('/grade/00000000000000000000000000000000/master.json')
.get('/00000000000000000000000000000000/master.json')
.expectBadge({
label: 'code quality',
message: 'project or branch not found',

View File

@@ -83,8 +83,7 @@ class DynamicGithubManifest extends ConditionalGithubAuthService {
static get route() {
return {
base: 'github/manifest-json',
format: '(?!v)([^/]+)/([^/]+)/([^/]+)/?([^/]+)?',
capture: ['key', 'user', 'repo', 'branch'],
pattern: ':key([^v/][^/]*)/:user/:repo/:branch*',
}
}

View File

@@ -12,14 +12,14 @@ module.exports = [
deprecatedService({
route: {
base: 'gittip',
pattern: ':various?',
pattern: ':various*',
},
...commonAttrs,
}),
deprecatedService({
route: {
base: 'gratipay',
pattern: ':various?',
pattern: ':various*',
},
...commonAttrs,
}),

View File

@@ -5,7 +5,7 @@ const { deprecatedService } = require('..')
module.exports = deprecatedService({
route: {
base: 'nsp/npm',
format: '(?:.+)',
pattern: ':various*',
},
label: 'nsp',
category: 'other',

View File

@@ -12,14 +12,14 @@ module.exports = [
deprecatedService({
route: {
base: 'snap',
format: '(?:[^/]+/[^/]+)(?:/(?:.+))',
pattern: ':various*',
},
...commonAttrs,
}),
deprecatedService({
route: {
base: 'snap-ci',
format: '(?:[^/]+/[^/]+)(?:/(?:.+))',
pattern: ':various*',
},
...commonAttrs,
}),