diff --git a/services/snyk/snyk-vulnerability-github.service.js b/services/snyk/snyk-vulnerability-github.service.js index ede8a0a503..445004f5ff 100644 --- a/services/snyk/snyk-vulnerability-github.service.js +++ b/services/snyk/snyk-vulnerability-github.service.js @@ -3,42 +3,38 @@ const SynkVulnerabilityBase = require('./snyk-vulnerability-base') module.exports = class SnykVulnerabilityGitHub extends SynkVulnerabilityBase { - static get route() { - return { - base: 'snyk/vulnerabilities/github', - pattern: ':user/:repo/:manifestFilePath*', - } + static route = { + base: 'snyk/vulnerabilities/github', + pattern: ':user/:repo/:manifestFilePath*', } - static get examples() { - return [ - { - title: 'Snyk Vulnerabilities for GitHub Repo', - pattern: ':user/:repo', - namedParams: { - user: 'badges', - repo: 'shields', - }, - staticPreview: this.render({ vulnerabilities: '0' }), + static examples = [ + { + title: 'Snyk Vulnerabilities for GitHub Repo', + pattern: ':user/:repo', + namedParams: { + user: 'badges', + repo: 'shields', }, - { - title: 'Snyk Vulnerabilities for GitHub Repo (Specific Manifest)', - pattern: ':user/:repo/:manifestFilePath', - namedParams: { - user: 'badges', - repo: 'shields', - manifestFilePath: 'badge-maker/package.json', - }, - staticPreview: this.render({ vulnerabilities: '0' }), - documentation: ` -

- Provide the path to your target manifest file relative to the base of your repository. - Snyk does not support using a specific branch for this, so do not include "blob" nor a branch name. -

- `, + staticPreview: this.render({ vulnerabilities: '0' }), + }, + { + title: 'Snyk Vulnerabilities for GitHub Repo (Specific Manifest)', + pattern: ':user/:repo/:manifestFilePath', + namedParams: { + user: 'badges', + repo: 'shields', + manifestFilePath: 'badge-maker/package.json', }, - ] - } + staticPreview: this.render({ vulnerabilities: '0' }), + documentation: ` +

+ Provide the path to your target manifest file relative to the base of your repository. + Snyk does not support using a specific branch for this, so do not include "blob" nor a branch name. +

+ `, + }, + ] async handle({ user, repo, manifestFilePath }) { const url = `https://snyk.io/test/github/${user}/${repo}/badge.svg` diff --git a/services/snyk/snyk-vulnerability-npm.service.js b/services/snyk/snyk-vulnerability-npm.service.js index 4e8d19dd32..2cbda0c683 100644 --- a/services/snyk/snyk-vulnerability-npm.service.js +++ b/services/snyk/snyk-vulnerability-npm.service.js @@ -4,41 +4,37 @@ const { NotFound } = require('..') const SynkVulnerabilityBase = require('./snyk-vulnerability-base') module.exports = class SnykVulnerabilityNpm extends SynkVulnerabilityBase { - static get route() { - return { - base: 'snyk/vulnerabilities/npm', - pattern: ':packageName(.+?)', - } + static route = { + base: 'snyk/vulnerabilities/npm', + pattern: ':packageName(.+?)', } - static get examples() { - return [ - { - title: 'Snyk Vulnerabilities for npm package', - pattern: ':packageName', - namedParams: { - packageName: 'mocha', - }, - staticPreview: this.render({ vulnerabilities: '0' }), + static examples = [ + { + title: 'Snyk Vulnerabilities for npm package', + pattern: ':packageName', + namedParams: { + packageName: 'mocha', }, - { - title: 'Snyk Vulnerabilities for npm package version', - pattern: ':packageName', - namedParams: { - packageName: 'mocha@4.0.0', - }, - staticPreview: this.render({ vulnerabilities: '1' }), + staticPreview: this.render({ vulnerabilities: '0' }), + }, + { + title: 'Snyk Vulnerabilities for npm package version', + pattern: ':packageName', + namedParams: { + packageName: 'mocha@4.0.0', }, - { - title: 'Snyk Vulnerabilities for npm scoped package', - pattern: ':packageName', - namedParams: { - packageName: '@babel/core', - }, - staticPreview: this.render({ vulnerabilities: '0' }), + staticPreview: this.render({ vulnerabilities: '1' }), + }, + { + title: 'Snyk Vulnerabilities for npm scoped package', + pattern: ':packageName', + namedParams: { + packageName: '@babel/core', }, - ] - } + staticPreview: this.render({ vulnerabilities: '0' }), + }, + ] async handle({ packageName }) { const url = `https://snyk.io/test/npm/${packageName}/badge.svg` diff --git a/services/sonar/sonar-coverage.service.js b/services/sonar/sonar-coverage.service.js index bfcee36728..df4edeb9bc 100644 --- a/services/sonar/sonar-coverage.service.js +++ b/services/sonar/sonar-coverage.service.js @@ -5,39 +5,31 @@ const SonarBase = require('./sonar-base') const { documentation, keywords, queryParamSchema } = require('./sonar-helpers') module.exports = class SonarCoverage extends SonarBase { - static get category() { - return 'coverage' + static category = 'coverage' + + static route = { + base: 'sonar/coverage', + pattern: ':component', + queryParamSchema, } - static get route() { - return { - base: 'sonar/coverage', - pattern: ':component', - queryParamSchema, - } - } - - static get examples() { - return [ - { - title: 'Sonar Coverage', - namedParams: { - component: 'org.ow2.petals:petals-se-ase', - }, - queryParams: { - server: 'http://sonar.petalslink.com', - sonarVersion: '4.2', - }, - staticPreview: this.render({ coverage: 63 }), - keywords, - documentation, + static examples = [ + { + title: 'Sonar Coverage', + namedParams: { + component: 'org.ow2.petals:petals-se-ase', }, - ] - } + queryParams: { + server: 'http://sonar.petalslink.com', + sonarVersion: '4.2', + }, + staticPreview: this.render({ coverage: 63 }), + keywords, + documentation, + }, + ] - static get defaultBadgeData() { - return { label: 'coverage' } - } + static defaultBadgeData = { label: 'coverage' } static render({ coverage }) { return { diff --git a/services/sonar/sonar-documented-api-density.service.js b/services/sonar/sonar-documented-api-density.service.js index 9af383ffbd..684152f5d6 100644 --- a/services/sonar/sonar-documented-api-density.service.js +++ b/services/sonar/sonar-documented-api-density.service.js @@ -12,39 +12,31 @@ const { const metric = 'public_documented_api_density' module.exports = class SonarDocumentedApiDensity extends SonarBase { - static get category() { - return 'analysis' + static category = 'analysis' + + static route = { + base: `sonar/${metric}`, + pattern: ':component', + queryParamSchema, } - static get route() { - return { - base: `sonar/${metric}`, - pattern: ':component', - queryParamSchema, - } - } - - static get examples() { - return [ - { - title: 'Sonar Documented API Density', - namedParams: { - component: 'org.ow2.petals:petals-se-ase', - }, - queryParams: { - server: 'http://sonar.petalslink.com', - sonarVersion: '4.2', - }, - staticPreview: this.render({ density: 82 }), - keywords, - documentation, + static examples = [ + { + title: 'Sonar Documented API Density', + namedParams: { + component: 'org.ow2.petals:petals-se-ase', }, - ] - } + queryParams: { + server: 'http://sonar.petalslink.com', + sonarVersion: '4.2', + }, + staticPreview: this.render({ density: 82 }), + keywords, + documentation, + }, + ] - static get defaultBadgeData() { - return { label: getLabel({ metric }) } - } + static defaultBadgeData = { label: getLabel({ metric }) } static render({ density }) { return { diff --git a/services/sonar/sonar-fortify-rating.service.js b/services/sonar/sonar-fortify-rating.service.js index 3234bffbf4..74cf396fb2 100644 --- a/services/sonar/sonar-fortify-rating.service.js +++ b/services/sonar/sonar-fortify-rating.service.js @@ -13,45 +13,37 @@ const colorMap = { } module.exports = class SonarFortifyRating extends SonarBase { - static get category() { - return 'analysis' + static category = 'analysis' + + static route = { + base: 'sonar/fortify-security-rating', + pattern: ':component', + queryParamSchema, } - static get route() { - return { - base: 'sonar/fortify-security-rating', - pattern: ':component', - queryParamSchema, - } - } - - static get examples() { - return [ - { - title: 'Sonar Fortify Security Rating', - namedParams: { - component: 'org.ow2.petals:petals-se-ase', - }, - queryParams: { - server: 'http://sonar.petalslink.com', - sonarVersion: '4.2', - }, - staticPreview: this.render({ rating: 4 }), - keywords, - documentation: ` -

- Note that the Fortify Security Rating badge will only work on Sonar instances that have the Fortify SonarQube Plugin installed. - The badge is not available for projects analyzed on SonarCloud.io -

- ${documentation} - `, + static examples = [ + { + title: 'Sonar Fortify Security Rating', + namedParams: { + component: 'org.ow2.petals:petals-se-ase', }, - ] - } + queryParams: { + server: 'http://sonar.petalslink.com', + sonarVersion: '4.2', + }, + staticPreview: this.render({ rating: 4 }), + keywords, + documentation: ` +

+ Note that the Fortify Security Rating badge will only work on Sonar instances that have the Fortify SonarQube Plugin installed. + The badge is not available for projects analyzed on SonarCloud.io +

+ ${documentation} + `, + }, + ] - static get defaultBadgeData() { - return { label: 'fortify-security-rating' } - } + static defaultBadgeData = { label: 'fortify-security-rating' } static render({ rating }) { return { diff --git a/services/sonar/sonar-generic.service.js b/services/sonar/sonar-generic.service.js index 6d1e3b9407..6b84986754 100644 --- a/services/sonar/sonar-generic.service.js +++ b/services/sonar/sonar-generic.service.js @@ -107,21 +107,15 @@ const metricNames = [ const metricNameRouteParam = metricNames.join('|') module.exports = class SonarGeneric extends SonarBase { - static get category() { - return 'analysis' + static category = 'analysis' + + static route = { + base: 'sonar', + pattern: `:metricName(${metricNameRouteParam})/:component`, + queryParamSchema, } - static get route() { - return { - base: 'sonar', - pattern: `:metricName(${metricNameRouteParam})/:component`, - queryParamSchema, - } - } - - static get defaultBadgeData() { - return { label: 'sonar' } - } + static defaultBadgeData = { label: 'sonar' } static render({ metricName, metricValue }) { return { diff --git a/services/sonar/sonar-quality-gate.service.js b/services/sonar/sonar-quality-gate.service.js index e31e582cb8..b615c5d5f2 100644 --- a/services/sonar/sonar-quality-gate.service.js +++ b/services/sonar/sonar-quality-gate.service.js @@ -4,40 +4,32 @@ const SonarBase = require('./sonar-base') const { documentation, keywords, queryParamSchema } = require('./sonar-helpers') module.exports = class SonarQualityGate extends SonarBase { - static get category() { - return 'analysis' + static category = 'analysis' + + static route = { + base: 'sonar', + pattern: ':metric(quality_gate|alert_status)/:component', + queryParamSchema, } - static get route() { - return { - base: 'sonar', - pattern: ':metric(quality_gate|alert_status)/:component', - queryParamSchema, - } - } - - static get examples() { - return [ - { - title: 'Sonar Quality Gate', - namedParams: { - component: 'swellaby:azdo-shellcheck', - metric: 'quality_gate', - }, - queryParams: { - server: 'https://sonarcloud.io', - sonarVersion: '4.2', - }, - staticPreview: this.render({ qualityState: 'OK' }), - keywords, - documentation, + static examples = [ + { + title: 'Sonar Quality Gate', + namedParams: { + component: 'swellaby:azdo-shellcheck', + metric: 'quality_gate', }, - ] - } + queryParams: { + server: 'https://sonarcloud.io', + sonarVersion: '4.2', + }, + staticPreview: this.render({ qualityState: 'OK' }), + keywords, + documentation, + }, + ] - static get defaultBadgeData() { - return { label: 'quality gate' } - } + static defaultBadgeData = { label: 'quality gate' } static render({ qualityState }) { if (qualityState === 'OK') { diff --git a/services/sonar/sonar-tech-debt.service.js b/services/sonar/sonar-tech-debt.service.js index 6a05f627d1..a54952cbb0 100644 --- a/services/sonar/sonar-tech-debt.service.js +++ b/services/sonar/sonar-tech-debt.service.js @@ -10,43 +10,35 @@ const { } = require('./sonar-helpers') module.exports = class SonarTechDebt extends SonarBase { - static get category() { - return 'analysis' + static category = 'analysis' + + static route = { + base: 'sonar', + pattern: ':metric(tech_debt|sqale_debt_ratio)/:component', + queryParamSchema, } - static get route() { - return { - base: 'sonar', - pattern: ':metric(tech_debt|sqale_debt_ratio)/:component', - queryParamSchema, - } - } - - static get examples() { - return [ - { - title: 'Sonar Tech Debt', - namedParams: { - component: 'org.ow2.petals:petals-se-ase', - metric: 'tech_debt', - }, - queryParams: { - server: 'http://sonar.petalslink.com', - sonarVersion: '4.2', - }, - staticPreview: this.render({ - debt: 1, - metric: 'tech_debt', - }), - keywords, - documentation, + static examples = [ + { + title: 'Sonar Tech Debt', + namedParams: { + component: 'org.ow2.petals:petals-se-ase', + metric: 'tech_debt', }, - ] - } + queryParams: { + server: 'http://sonar.petalslink.com', + sonarVersion: '4.2', + }, + staticPreview: this.render({ + debt: 1, + metric: 'tech_debt', + }), + keywords, + documentation, + }, + ] - static get defaultBadgeData() { - return { label: 'tech debt' } - } + static defaultBadgeData = { label: 'tech debt' } static render({ debt, metric }) { return { diff --git a/services/sonar/sonar-tests.service.js b/services/sonar/sonar-tests.service.js index 9720f40d17..67d1226037 100644 --- a/services/sonar/sonar-tests.service.js +++ b/services/sonar/sonar-tests.service.js @@ -15,53 +15,45 @@ const { } = require('./sonar-helpers') class SonarTestsSummary extends SonarBase { - static get category() { - return 'build' + static category = 'build' + + static route = { + base: 'sonar/tests', + pattern: ':component', + queryParamSchema: queryParamSchema.concat(testResultQueryParamSchema), } - static get route() { - return { - base: 'sonar/tests', - pattern: ':component', - queryParamSchema: queryParamSchema.concat(testResultQueryParamSchema), - } - } - - static get examples() { - return [ - { - title: 'Sonar Tests', - namedParams: { - component: 'org.ow2.petals:petals-se-ase', - }, - queryParams: { - server: 'http://sonar.petalslink.com', - sonarVersion: '4.2', - compact_message: null, - passed_label: 'passed', - failed_label: 'failed', - skipped_label: 'skipped', - }, - staticPreview: this.render({ - passed: 5, - failed: 1, - skipped: 0, - total: 6, - isCompact: false, - }), - keywords, - documentation: ` - ${documentation} - ${testResultsDocumentation} - `, + static examples = [ + { + title: 'Sonar Tests', + namedParams: { + component: 'org.ow2.petals:petals-se-ase', }, - ] - } + queryParams: { + server: 'http://sonar.petalslink.com', + sonarVersion: '4.2', + compact_message: null, + passed_label: 'passed', + failed_label: 'failed', + skipped_label: 'skipped', + }, + staticPreview: this.render({ + passed: 5, + failed: 1, + skipped: 0, + total: 6, + isCompact: false, + }), + keywords, + documentation: ` + ${documentation} + ${testResultsDocumentation} + `, + }, + ] - static get defaultBadgeData() { - return { - label: 'tests', - } + static defaultBadgeData = { + label: 'tests', } static render({ @@ -139,81 +131,73 @@ class SonarTestsSummary extends SonarBase { } class SonarTests extends SonarBase { - static get category() { - return 'build' + static category = 'build' + + static route = { + base: 'sonar', + pattern: + ':metric(total_tests|skipped_tests|test_failures|test_errors|test_execution_time|test_success_density)/:component', + queryParamSchema, } - static get route() { - return { - base: 'sonar', + static examples = [ + { + title: 'Sonar Test Count', pattern: - ':metric(total_tests|skipped_tests|test_failures|test_errors|test_execution_time|test_success_density)/:component', - queryParamSchema, - } - } + ':metric(total_tests|skipped_tests|test_failures|test_errors)/:component', + namedParams: { + component: 'org.ow2.petals:petals-log', + metric: 'total_tests', + }, + queryParams: { + server: 'http://sonar.petalslink.com', + sonarVersion: '4.2', + }, + staticPreview: this.render({ + metric: 'total_tests', + value: 131, + }), + keywords, + documentation, + }, + { + title: 'Sonar Test Execution Time', + pattern: 'test_execution_time/:component', + namedParams: { + component: 'swellaby:azure-pipelines-templates', + }, + queryParams: { + server: 'https://sonarcloud.io', + sonarVersion: '4.2', + }, + staticPreview: this.render({ + metric: 'test_execution_time', + value: 2, + }), + keywords, + documentation, + }, + { + title: 'Sonar Test Success Rate', + pattern: 'test_success_density/:component', + namedParams: { + component: 'swellaby:azure-pipelines-templates', + }, + queryParams: { + server: 'https://sonarcloud.io', + sonarVersion: '4.2', + }, + staticPreview: this.render({ + metric: 'test_success_density', + value: 100, + }), + keywords, + documentation, + }, + ] - static get examples() { - return [ - { - title: 'Sonar Test Count', - pattern: - ':metric(total_tests|skipped_tests|test_failures|test_errors)/:component', - namedParams: { - component: 'org.ow2.petals:petals-log', - metric: 'total_tests', - }, - queryParams: { - server: 'http://sonar.petalslink.com', - sonarVersion: '4.2', - }, - staticPreview: this.render({ - metric: 'total_tests', - value: 131, - }), - keywords, - documentation, - }, - { - title: 'Sonar Test Execution Time', - pattern: 'test_execution_time/:component', - namedParams: { - component: 'swellaby:azure-pipelines-templates', - }, - queryParams: { - server: 'https://sonarcloud.io', - sonarVersion: '4.2', - }, - staticPreview: this.render({ - metric: 'test_execution_time', - value: 2, - }), - keywords, - documentation, - }, - { - title: 'Sonar Test Success Rate', - pattern: 'test_success_density/:component', - namedParams: { - component: 'swellaby:azure-pipelines-templates', - }, - queryParams: { - server: 'https://sonarcloud.io', - sonarVersion: '4.2', - }, - staticPreview: this.render({ - metric: 'test_success_density', - value: 100, - }), - keywords, - documentation, - }, - ] - } - - static get defaultBadgeData() { - return { - label: 'tests', - } + static defaultBadgeData = { + label: 'tests', } static render({ value, metric }) { diff --git a/services/sonar/sonar-violations.service.js b/services/sonar/sonar-violations.service.js index caa4f7516f..54de34b9bf 100644 --- a/services/sonar/sonar-violations.service.js +++ b/services/sonar/sonar-violations.service.js @@ -24,67 +24,59 @@ const violationCategoryColorMap = { } module.exports = class SonarViolations extends SonarBase { - static get category() { - return 'analysis' + static category = 'analysis' + + static route = { + base: 'sonar', + pattern: + ':metric(violations|blocker_violations|critical_violations|major_violations|minor_violations|info_violations)/:component', + queryParamSchema: queryParamWithFormatSchema, } - static get route() { - return { - base: 'sonar', - pattern: - ':metric(violations|blocker_violations|critical_violations|major_violations|minor_violations|info_violations)/:component', - queryParamSchema: queryParamWithFormatSchema, - } - } - - static get examples() { - return [ - { - title: 'Sonar Violations (short format)', - namedParams: { - component: 'swellaby:azdo-shellcheck', - metric: 'violations', - }, - queryParams: { - server: 'https://sonarcloud.io', - format: 'short', - sonarVersion: '4.2', - }, - staticPreview: this.render({ - violations: 0, - metricName: 'violations', - format: 'short', - }), - keywords, - documentation, + static examples = [ + { + title: 'Sonar Violations (short format)', + namedParams: { + component: 'swellaby:azdo-shellcheck', + metric: 'violations', }, - { - title: 'Sonar Violations (long format)', - namedParams: { - component: 'org.ow2.petals:petals-se-ase', - metric: 'violations', - }, - queryParams: { - server: 'http://sonar.petalslink.com', - format: 'long', - }, - staticPreview: this.render({ - violations: { - info_violations: 2, - minor_violations: 1, - }, - metricName: 'violations', - format: 'long', - }), - keywords, - documentation, + queryParams: { + server: 'https://sonarcloud.io', + format: 'short', + sonarVersion: '4.2', }, - ] - } + staticPreview: this.render({ + violations: 0, + metricName: 'violations', + format: 'short', + }), + keywords, + documentation, + }, + { + title: 'Sonar Violations (long format)', + namedParams: { + component: 'org.ow2.petals:petals-se-ase', + metric: 'violations', + }, + queryParams: { + server: 'http://sonar.petalslink.com', + format: 'long', + }, + staticPreview: this.render({ + violations: { + info_violations: 2, + minor_violations: 1, + }, + metricName: 'violations', + format: 'long', + }), + keywords, + documentation, + }, + ] - static get defaultBadgeData() { - return { label: 'violations' } - } + static defaultBadgeData = { label: 'violations' } static renderLongViolationsBadge(violations) { if (violations.violations === 0) { diff --git a/services/sourceforge/sourceforge-open-tickets.service.js b/services/sourceforge/sourceforge-open-tickets.service.js index 4011cb29d3..6ad2cb4cee 100644 --- a/services/sourceforge/sourceforge-open-tickets.service.js +++ b/services/sourceforge/sourceforge-open-tickets.service.js @@ -10,35 +10,27 @@ const schema = Joi.object({ }).required() module.exports = class SourceforgeOpenTickets extends BaseJsonService { - static get category() { - return 'other' + static category = 'other' + + static route = { + base: 'sourceforge/open-tickets', + pattern: ':project/:type(bugs|feature-requests)', } - static get route() { - return { - base: 'sourceforge/open-tickets', - pattern: ':project/:type(bugs|feature-requests)', - } - } - - static get examples() { - return [ - { - title: 'Sourceforge Open Tickets', - namedParams: { - type: 'bugs', - project: 'sevenzip', - }, - staticPreview: this.render({ count: 1338 }), + static examples = [ + { + title: 'Sourceforge Open Tickets', + namedParams: { + type: 'bugs', + project: 'sevenzip', }, - ] - } + staticPreview: this.render({ count: 1338 }), + }, + ] - static get defaultBadgeData() { - return { - label: 'open tickets', - color: 'blue', - } + static defaultBadgeData = { + label: 'open tickets', + color: 'blue', } static render({ count }) { diff --git a/services/sourceforge/sourceforge.service.js b/services/sourceforge/sourceforge.service.js index 527ab97040..674337c728 100644 --- a/services/sourceforge/sourceforge.service.js +++ b/services/sourceforge/sourceforge.service.js @@ -32,50 +32,42 @@ const intervalMap = { } module.exports = class Sourceforge extends BaseJsonService { - static get category() { - return 'downloads' + static category = 'downloads' + + static route = { + base: 'sourceforge', + pattern: ':interval(dt|dm|dw|dd)/:project/:folder*', } - static get route() { - return { - base: 'sourceforge', - pattern: ':interval(dt|dm|dw|dd)/:project/:folder*', - } - } - - static get examples() { - return [ - { - title: 'SourceForge', - pattern: ':interval(dt|dm|dw|dd)/:project', - namedParams: { - interval: 'dm', - project: 'sevenzip', - }, - staticPreview: this.render({ - downloads: 215990, - interval: 'dm', - }), + static examples = [ + { + title: 'SourceForge', + pattern: ':interval(dt|dm|dw|dd)/:project', + namedParams: { + interval: 'dm', + project: 'sevenzip', }, - { - title: 'SourceForge', - pattern: ':interval(dt|dm|dw|dd)/:project/:folder', - namedParams: { - interval: 'dm', - project: 'arianne', - folder: 'stendhal', - }, - staticPreview: this.render({ - downloads: 550, - interval: 'dm', - }), + staticPreview: this.render({ + downloads: 215990, + interval: 'dm', + }), + }, + { + title: 'SourceForge', + pattern: ':interval(dt|dm|dw|dd)/:project/:folder', + namedParams: { + interval: 'dm', + project: 'arianne', + folder: 'stendhal', }, - ] - } + staticPreview: this.render({ + downloads: 550, + interval: 'dm', + }), + }, + ] - static get defaultBadgeData() { - return { label: 'sourceforge' } - } + static defaultBadgeData = { label: 'sourceforge' } static render({ downloads, interval }) { return { diff --git a/services/sourcegraph/sourcegraph.service.js b/services/sourcegraph/sourcegraph.service.js index 183207d9a9..d2a218672d 100644 --- a/services/sourcegraph/sourcegraph.service.js +++ b/services/sourcegraph/sourcegraph.service.js @@ -9,33 +9,25 @@ const schema = Joi.object({ }).required() module.exports = class Sourcegraph extends BaseJsonService { - static get category() { - return 'other' + static category = 'other' + + static route = { + base: 'sourcegraph/rrc', + pattern: ':repo(.*?)', } - static get route() { - return { - base: 'sourcegraph/rrc', - pattern: ':repo(.*?)', - } - } - - static get examples() { - return [ - { - title: 'Sourcegraph for Repo Reference Count', - pattern: ':repo', - namedParams: { - repo: 'github.com/gorilla/mux', - }, - staticPreview: this.render({ projectsCount: '9.9k projects' }), + static examples = [ + { + title: 'Sourcegraph for Repo Reference Count', + pattern: ':repo', + namedParams: { + repo: 'github.com/gorilla/mux', }, - ] - } + staticPreview: this.render({ projectsCount: '9.9k projects' }), + }, + ] - static get defaultBadgeData() { - return { color: 'brightgreen', label: 'used by' } - } + static defaultBadgeData = { color: 'brightgreen', label: 'used by' } static render({ projectsCount }) { return { diff --git a/services/spack/spack.service.js b/services/spack/spack.service.js index 9046e8f26c..fd0ead60d6 100644 --- a/services/spack/spack.service.js +++ b/services/spack/spack.service.js @@ -8,31 +8,23 @@ const schema = Joi.object({ }).required() module.exports = class SpackVersion extends BaseJsonService { - static get category() { - return 'version' + static category = 'version' + + static route = { + base: 'spack/v', + pattern: ':packageName', } - static get route() { - return { - base: 'spack/v', - pattern: ':packageName', - } - } + static examples = [ + { + title: 'Spack', + namedParams: { packageName: 'adios2' }, + staticPreview: this.render({ version: '2.3.1' }), + keywords: ['hpc'], + }, + ] - static get examples() { - return [ - { - title: 'Spack', - namedParams: { packageName: 'adios2' }, - staticPreview: this.render({ version: '2.3.1' }), - keywords: ['hpc'], - }, - ] - } - - static get defaultBadgeData() { - return { label: 'spack' } - } + static defaultBadgeData = { label: 'spack' } static render({ version }) { return renderVersionBadge({ version })