diff --git a/services/cii-best-practices/cii-best-practices.service.js b/services/cii-best-practices/cii-best-practices.service.js index bc7eda1469..dfe52ff239 100644 --- a/services/cii-best-practices/cii-best-practices.service.js +++ b/services/cii-best-practices/cii-best-practices.service.js @@ -31,56 +31,45 @@ const summaryColorScale = colorScale( ) module.exports = class CIIBestPracticesService extends BaseJsonService { - static get category() { - return 'analysis' + static category = 'analysis' + static route = { + base: 'cii', + pattern: ':metric(level|percentage|summary)/:projectId', } - static get route() { - return { - base: 'cii', - pattern: ':metric(level|percentage|summary)/:projectId', - } - } + static exampless = [ + { + title: 'CII Best Practices Level', + pattern: 'level/:projectId', + namedParams: { + projectId: '1', + }, + staticPreview: this.renderLevelBadge({ level: 'gold' }), + keywords, + }, + { + title: 'CII Best Practices Tiered Percentage', + pattern: 'percentage/:projectId', + namedParams: { + projectId: '29', + }, + staticPreview: this.renderTieredPercentageBadge({ percentage: 107 }), + keywords, + }, + { + title: 'CII Best Practices Summary', + pattern: 'summary/:projectId', + namedParams: { + projectId: '33', + }, + staticPreview: this.renderSummaryBadge({ percentage: 94 }), + keywords, + documentation: + 'This badge uses the same message and color scale as the native CII one, but with all the configuration and goodness that Shields provides!', + }, + ] - static get examples() { - return [ - { - title: 'CII Best Practices Level', - pattern: 'level/:projectId', - namedParams: { - projectId: '1', - }, - staticPreview: this.renderLevelBadge({ level: 'gold' }), - keywords, - }, - { - title: 'CII Best Practices Tiered Percentage', - pattern: 'percentage/:projectId', - namedParams: { - projectId: '29', - }, - staticPreview: this.renderTieredPercentageBadge({ percentage: 107 }), - keywords, - }, - { - title: 'CII Best Practices Summary', - pattern: 'summary/:projectId', - namedParams: { - projectId: '33', - }, - staticPreview: this.renderSummaryBadge({ percentage: 94 }), - keywords, - documentation: - 'This badge uses the same message and color scale as the native CII one, but with all the configuration and goodness that Shields provides!', - }, - ] - } - - static get defaultBadgeData() { - return { - label: 'cii', - } - } + static defaultBadgeData = { label: 'cii' } static renderLevelBadge({ level }) { let message = level diff --git a/services/circleci/circleci.service.js b/services/circleci/circleci.service.js index 5979a1bf7a..6e2bca6a60 100644 --- a/services/circleci/circleci.service.js +++ b/services/circleci/circleci.service.js @@ -20,40 +20,31 @@ const documentation = ` const vcsTypeMap = { gh: 'gh', github: 'gh', bb: 'bb', bitbucket: 'bb' } class CircleCi extends BaseSvgScrapingService { - static get category() { - return 'build' + static category = 'build' + static route = { + base: 'circleci/build', + pattern: ':vcsType(github|gh|bitbucket|bb)/:user/:repo/:branch*', + queryParamSchema, } - static get route() { - return { - base: 'circleci/build', - pattern: ':vcsType(github|gh|bitbucket|bb)/:user/:repo/:branch*', - queryParamSchema, - } - } - - static get examples() { - return [ - { - title: 'CircleCI', - namedParams: { - vcsType: 'github', - user: 'RedSparr0w', - repo: 'node-csgo-parser', - branch: 'master', - }, - queryParams: { - token: 'abc123def456', - }, - staticPreview: this.render({ status: 'success' }), - documentation, + static examples = [ + { + title: 'CircleCI', + namedParams: { + vcsType: 'github', + user: 'RedSparr0w', + repo: 'node-csgo-parser', + branch: 'master', }, - ] - } + queryParams: { + token: 'abc123def456', + }, + staticPreview: this.render({ status: 'success' }), + documentation, + }, + ] - static get defaultBadgeData() { - return { label: 'build' } - } + static defaultBadgeData = { label: 'build' } static render({ status }) { return renderBuildStatusBadge({ status: status.replace('_', ' ') }) diff --git a/services/cirrus/cirrus.service.js b/services/cirrus/cirrus.service.js index a773d9809d..32d8da0e2d 100644 --- a/services/cirrus/cirrus.service.js +++ b/services/cirrus/cirrus.service.js @@ -16,57 +16,48 @@ const queryParamSchema = Joi.object({ }).required() module.exports = class Cirrus extends BaseJsonService { - static get category() { - return 'build' + static category = 'build' + static route = { + base: 'cirrus', + pattern: 'github/:user/:repo/:branch*', + queryParamSchema, } - static get route() { - return { - base: 'cirrus', - pattern: 'github/:user/:repo/:branch*', - queryParamSchema, - } - } + static examples = [ + { + title: 'Cirrus CI - Base Branch Build Status', + namedParams: { user: 'flutter', repo: 'flutter' }, + pattern: 'github/:user/:repo', + queryParams: { task: 'analyze', script: 'test' }, + staticPreview: this.render({ status: 'passing' }), + }, + { + title: 'Cirrus CI - Specific Branch Build Status', + pattern: 'github/:user/:repo/:branch', + namedParams: { user: 'flutter', repo: 'flutter', branch: 'master' }, + queryParams: { task: 'analyze', script: 'test' }, + staticPreview: this.render({ status: 'passing' }), + }, + { + title: 'Cirrus CI - Specific Task Build Status', + pattern: 'github/:user/:repo', + queryParams: { task: 'analyze' }, + namedParams: { user: 'flutter', repo: 'flutter' }, + staticPreview: this.render({ subject: 'analyze', status: 'passing' }), + }, + { + title: 'Cirrus CI - Task and Script Build Status', + pattern: 'github/:user/:repo', + queryParams: { task: 'analyze', script: 'test' }, + namedParams: { + user: 'flutter', + repo: 'flutter', + }, + staticPreview: this.render({ subject: 'test', status: 'passing' }), + }, + ] - static get examples() { - return [ - { - title: 'Cirrus CI - Base Branch Build Status', - namedParams: { user: 'flutter', repo: 'flutter' }, - pattern: 'github/:user/:repo', - queryParams: { task: 'analyze', script: 'test' }, - staticPreview: this.render({ status: 'passing' }), - }, - { - title: 'Cirrus CI - Specific Branch Build Status', - pattern: 'github/:user/:repo/:branch', - namedParams: { user: 'flutter', repo: 'flutter', branch: 'master' }, - queryParams: { task: 'analyze', script: 'test' }, - staticPreview: this.render({ status: 'passing' }), - }, - { - title: 'Cirrus CI - Specific Task Build Status', - pattern: 'github/:user/:repo', - queryParams: { task: 'analyze' }, - namedParams: { user: 'flutter', repo: 'flutter' }, - staticPreview: this.render({ subject: 'analyze', status: 'passing' }), - }, - { - title: 'Cirrus CI - Task and Script Build Status', - pattern: 'github/:user/:repo', - queryParams: { task: 'analyze', script: 'test' }, - namedParams: { - user: 'flutter', - repo: 'flutter', - }, - staticPreview: this.render({ subject: 'test', status: 'passing' }), - }, - ] - } - - static get defaultBadgeData() { - return { label: 'build' } - } + static defaultBadgeData = { label: 'build' } static render({ subject, status }) { return renderBuildStatusBadge({ label: subject, status })