diff --git a/services/codacy/codacy-coverage.service.js b/services/codacy/codacy-coverage.service.js index 6cd3f0bbf0..458e2c4cac 100644 --- a/services/codacy/codacy-coverage.service.js +++ b/services/codacy/codacy-coverage.service.js @@ -14,42 +14,28 @@ const schema = Joi.object({ }).required() module.exports = class CodacyCoverage extends BaseSvgScrapingService { - static get category() { - return 'coverage' - } + static category = 'coverage' + static route = { base: 'codacy/coverage', pattern: ':projectId/:branch*' } - static get route() { - return { - base: 'codacy/coverage', - pattern: ':projectId/:branch*', - } - } - - static get examples() { - return [ - { - title: 'Codacy coverage', - pattern: ':projectId', - namedParams: { projectId: '59d607d0e311408885e418004068ea58' }, - staticPreview: this.render({ percentage: 90 }), + static examples = [ + { + title: 'Codacy coverage', + pattern: ':projectId', + namedParams: { projectId: '59d607d0e311408885e418004068ea58' }, + staticPreview: this.render({ percentage: 90 }), + }, + { + title: 'Codacy branch coverage', + pattern: ':projectId/:branch', + namedParams: { + projectId: '59d607d0e311408885e418004068ea58', + branch: 'master', }, - { - title: 'Codacy branch coverage', - pattern: ':projectId/:branch', - namedParams: { - projectId: '59d607d0e311408885e418004068ea58', - branch: 'master', - }, - staticPreview: this.render({ percentage: 90 }), - }, - ] - } + staticPreview: this.render({ percentage: 90 }), + }, + ] - static get defaultBadgeData() { - return { - label: 'coverage', - } - } + static defaultBadgeData = { label: 'coverage' } static render({ percentage }) { return { diff --git a/services/codacy/codacy-grade.service.js b/services/codacy/codacy-grade.service.js index 337a835ae4..193a67a5ce 100644 --- a/services/codacy/codacy-grade.service.js +++ b/services/codacy/codacy-grade.service.js @@ -7,42 +7,28 @@ const { codacyGrade } = require('./codacy-helpers') const schema = Joi.object({ message: codacyGrade }).required() module.exports = class CodacyGrade extends BaseSvgScrapingService { - static get category() { - return 'analysis' - } + static category = 'analysis' + static route = { base: 'codacy/grade', pattern: ':projectId/:branch*' } - static get route() { - return { - base: 'codacy/grade', - pattern: ':projectId/:branch*', - } - } - - static get examples() { - return [ - { - title: 'Codacy grade', - pattern: ':projectId', - namedParams: { projectId: 'e27821fb6289410b8f58338c7e0bc686' }, - staticPreview: this.render({ grade: 'A' }), + static examples = [ + { + title: 'Codacy grade', + pattern: ':projectId', + namedParams: { projectId: 'e27821fb6289410b8f58338c7e0bc686' }, + staticPreview: this.render({ grade: 'A' }), + }, + { + title: 'Codacy branch grade', + pattern: ':projectId/:branch', + namedParams: { + projectId: 'e27821fb6289410b8f58338c7e0bc686', + branch: 'master', }, - { - title: 'Codacy branch grade', - pattern: ':projectId/:branch', - namedParams: { - projectId: 'e27821fb6289410b8f58338c7e0bc686', - branch: 'master', - }, - staticPreview: this.render({ grade: 'A' }), - }, - ] - } + staticPreview: this.render({ grade: 'A' }), + }, + ] - static get defaultBadgeData() { - return { - label: 'code quality', - } - } + static defaultBadgeData = { label: 'code quality' } static render({ grade }) { const color = { diff --git a/services/codeclimate/codeclimate-analysis.service.js b/services/codeclimate/codeclimate-analysis.service.js index 3468099657..3080fcc053 100644 --- a/services/codeclimate/codeclimate-analysis.service.js +++ b/services/codeclimate/codeclimate-analysis.service.js @@ -88,57 +88,50 @@ const variantMap = { } module.exports = class CodeclimateAnalysis extends BaseJsonService { - static get category() { - return 'analysis' + static category = 'analysis' + static route = { + base: 'codeclimate', + pattern: + ':variant(maintainability|maintainability-percentage|tech-debt|issues)/:user/:repo', } - static get route() { - return { - base: 'codeclimate', + static examples = [ + { + title: 'Code Climate maintainability', pattern: - ':variant(maintainability|maintainability-percentage|tech-debt|issues)/:user/:repo', - } - } - - static get examples() { - return [ - { - title: 'Code Climate maintainability', - pattern: - ':format(maintainability|maintainability-percentage)/:user/:repo', - namedParams: { - format: 'maintainability', - user: 'angular', - repo: 'angular', - }, - staticPreview: this.render({ - variant: 'maintainability', - maintainabilityLetter: 'F', - }), - keywords, + ':format(maintainability|maintainability-percentage)/:user/:repo', + namedParams: { + format: 'maintainability', + user: 'angular', + repo: 'angular', }, - { - title: 'Code Climate issues', - pattern: 'issues/:user/:repo', - namedParams: { user: 'twbs', repo: 'bootstrap' }, - staticPreview: this.render({ - variant: 'issues', - issueCount: '89', - }), - keywords, - }, - { - title: 'Code Climate technical debt', - pattern: 'tech-debt/:user/:repo', - namedParams: { user: 'angular', repo: 'angular' }, - staticPreview: this.render({ - variant: 'tech-debt', - techDebtPercentage: 3.0, - }), - keywords, - }, - ] - } + staticPreview: this.render({ + variant: 'maintainability', + maintainabilityLetter: 'F', + }), + keywords, + }, + { + title: 'Code Climate issues', + pattern: 'issues/:user/:repo', + namedParams: { user: 'twbs', repo: 'bootstrap' }, + staticPreview: this.render({ + variant: 'issues', + issueCount: '89', + }), + keywords, + }, + { + title: 'Code Climate technical debt', + pattern: 'tech-debt/:user/:repo', + namedParams: { user: 'angular', repo: 'angular' }, + staticPreview: this.render({ + variant: 'tech-debt', + techDebtPercentage: 3.0, + }), + keywords, + }, + ] static render({ variant, ...props }) { const { render } = variantMap[variant] diff --git a/services/codeclimate/codeclimate-coverage.service.js b/services/codeclimate/codeclimate-coverage.service.js index 0d2c67e95b..174f124290 100644 --- a/services/codeclimate/codeclimate-coverage.service.js +++ b/services/codeclimate/codeclimate-coverage.service.js @@ -17,35 +17,28 @@ const schema = Joi.object({ }).required() module.exports = class CodeclimateCoverage extends BaseJsonService { - static get category() { - return 'coverage' + static category = 'coverage' + static route = { + base: 'codeclimate', + pattern: ':format(coverage|coverage-letter)/:user/:repo', } - static get route() { - return { - base: 'codeclimate', - pattern: ':format(coverage|coverage-letter)/:user/:repo', - } - } - - static get examples() { - return [ - { - title: 'Code Climate coverage', - namedParams: { - format: 'coverage', - user: 'codeclimate', - repo: 'codeclimate', - }, - staticPreview: this.render({ - format: 'coverage', - percentage: 95.123, - letter: 'A', - }), - keywords, + static examples = [ + { + title: 'Code Climate coverage', + namedParams: { + format: 'coverage', + user: 'codeclimate', + repo: 'codeclimate', }, - ] - } + staticPreview: this.render({ + format: 'coverage', + percentage: 95.123, + letter: 'A', + }), + keywords, + }, + ] static render({ wantLetter, percentage, letter }) { if (wantLetter) { diff --git a/services/codecov/codecov.service.js b/services/codecov/codecov.service.js index 5849047ba9..6091d25d14 100644 --- a/services/codecov/codecov.service.js +++ b/services/codecov/codecov.service.js @@ -46,61 +46,50 @@ const documentation = ` ` module.exports = class Codecov extends BaseSvgScrapingService { - static get category() { - return 'coverage' + static category = 'coverage' + static route = { + base: 'codecov/c', + // https://docs.codecov.io/docs#section-common-questions + // Github, BitBucket, and GitLab are the only supported options (long or short form) + pattern: ':vcsName(github|gh|bitbucket|bb|gl|gitlab)/:user/:repo/:branch*', + queryParamSchema, } - static get route() { - return { - base: 'codecov/c', - // https://docs.codecov.io/docs#section-common-questions - // Github, BitBucket, and GitLab are the only supported options (long or short form) - pattern: - ':vcsName(github|gh|bitbucket|bb|gl|gitlab)/:user/:repo/:branch*', - queryParamSchema, - } - } - - static get examples() { - return [ - { - title: 'Codecov', - pattern: ':vcsName(github|gh|bitbucket|bb|gl|gitlab)/:user/:repo', - namedParams: { - vcsName: 'github', - user: 'codecov', - repo: 'example-node', - }, - queryParams: { - token: 'a1b2c3d4e5', - flag: 'flag_name', - }, - staticPreview: this.render({ coverage: 90 }), - documentation, + static examples = [ + { + title: 'Codecov', + pattern: ':vcsName(github|gh|bitbucket|bb|gl|gitlab)/:user/:repo', + namedParams: { + vcsName: 'github', + user: 'codecov', + repo: 'example-node', }, - { - title: 'Codecov branch', - pattern: - ':vcsName(github|gh|bitbucket|bb|gl|gitlab)/:user/:repo/:branch', - namedParams: { - vcsName: 'github', - user: 'codecov', - repo: 'example-node', - branch: 'master', - }, - queryParams: { - token: 'a1b2c3d4e5', - flag: 'flag_name', - }, - staticPreview: this.render({ coverage: 90 }), - documentation, + queryParams: { + token: 'a1b2c3d4e5', + flag: 'flag_name', }, - ] - } + staticPreview: this.render({ coverage: 90 }), + documentation, + }, + { + title: 'Codecov branch', + pattern: ':vcsName(github|gh|bitbucket|bb|gl|gitlab)/:user/:repo/:branch', + namedParams: { + vcsName: 'github', + user: 'codecov', + repo: 'example-node', + branch: 'master', + }, + queryParams: { + token: 'a1b2c3d4e5', + flag: 'flag_name', + }, + staticPreview: this.render({ coverage: 90 }), + documentation, + }, + ] - static get defaultBadgeData() { - return { label: 'coverage' } - } + static defaultBadgeData = { label: 'coverage' } static render({ coverage }) { if (coverage === 'unknown') {