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