Disallow redundant example patterns (#2787)
This commit is contained in:
@@ -106,7 +106,6 @@ function pullRequestClassGenerator(raw) {
|
||||
return [
|
||||
{
|
||||
title: 'Bitbucket open pull requests',
|
||||
pattern: ':user/:repo',
|
||||
namedParams: {
|
||||
user: 'atlassian',
|
||||
repo: 'python-bitbucket',
|
||||
@@ -120,7 +119,6 @@ function pullRequestClassGenerator(raw) {
|
||||
repo: 'bar',
|
||||
},
|
||||
queryParams: { server: 'https://bitbucket.mydomain.net' },
|
||||
pattern: ':user/:repo',
|
||||
staticPreview: this.render({ prs: 42 }),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -41,7 +41,6 @@ module.exports = class Codetally extends BaseJsonService {
|
||||
return [
|
||||
{
|
||||
title: 'Codetally',
|
||||
pattern: ':owner/:repo',
|
||||
namedParams: {
|
||||
owner: 'triggerman722',
|
||||
repo: 'colorstrap',
|
||||
|
||||
@@ -18,7 +18,6 @@ module.exports = class Gitter extends BaseStaticService {
|
||||
return [
|
||||
{
|
||||
title: 'Gitter',
|
||||
pattern: ':user/:repo',
|
||||
namedParams: {
|
||||
user: 'nwjs',
|
||||
repo: 'nw.js',
|
||||
|
||||
@@ -201,7 +201,6 @@ module.exports = class Matrix extends BaseJsonService {
|
||||
{
|
||||
title: 'Matrix',
|
||||
namedParams: { roomAlias: 'twim:matrix.org' },
|
||||
pattern: ':roomAlias',
|
||||
staticPreview: this.render({ members: 42 }),
|
||||
documentation,
|
||||
},
|
||||
@@ -209,7 +208,6 @@ module.exports = class Matrix extends BaseJsonService {
|
||||
title: 'Matrix',
|
||||
namedParams: { roomAlias: 'twim:matrix.org' },
|
||||
queryParams: { server_fqdn: 'matrix.org' },
|
||||
pattern: ':roomAlias',
|
||||
staticPreview: this.render({ members: 42 }),
|
||||
documentation,
|
||||
},
|
||||
|
||||
@@ -66,6 +66,13 @@ function validateExample(example, index, ServiceClass) {
|
||||
} at index ${index} also declares a dynamic previewUrl, which is not allowed`
|
||||
)
|
||||
}
|
||||
if (pattern === ServiceClass.route.pattern) {
|
||||
throw new Error(
|
||||
`Example for ${
|
||||
ServiceClass.name
|
||||
} at index ${index} declares a redundant pattern which should be removed`
|
||||
)
|
||||
}
|
||||
|
||||
// Make sure we can build the full URL using these patterns.
|
||||
try {
|
||||
|
||||
@@ -122,7 +122,6 @@ class WordpressPluginTestedVersion extends BaseWordpressPlatform {
|
||||
return [
|
||||
{
|
||||
title: 'Wordpress Plugin: Tested WP Version',
|
||||
pattern: ':slug',
|
||||
namedParams: { slug: 'bbpress' },
|
||||
staticPreview: this.render({ version: '4.9.8', color: 'brightgreen' }),
|
||||
documentation: `<p>There is an alias for this badge. <code>wordpress/v/:slug.svg</code></p>`,
|
||||
|
||||
Reference in New Issue
Block a user