Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.map(([depName, depStatus]) => ({
title:
depStatus === DependencyStatus.Unreviewed
? `Unreviewed npm dependency in use: ${depName}`
: `Forbidden npm dependency in use: ${depName}`,
type:
depStatus === DependencyStatus.Unreviewed
? sourcegraph.NotificationType.Warning
: sourcegraph.NotificationType.Error,
})),
}
import * as sourcegraph from 'sourcegraph'
import { Unsubscribable, Subscription } from 'rxjs'
const STATUSES: (sourcegraph.Status & { name: string })[] = [
{
name: 'code-churn',
title: 'Code churn',
state: {
completion: sourcegraph.CheckResult.Completed,
result: sourcegraph.CheckResult.ActionRequired,
message: 'High code churn detected',
},
notifications: [
{ title: 'my notif1', type: sourcegraph.NotificationType.Info },
{ title: 'my notif2', type: sourcegraph.NotificationType.Error },
],
},
]
export function registerSampleStatusProviders(): Unsubscribable {
const subscriptions = new Subscription()
for (const status of STATUSES) {
subscriptions.add(
sourcegraph.status.registerStatusProvider(status.name, {
provideStatus: () => status,
})
)
}
return subscriptions
}
switchMap(async diagnostics => [
{
message: 'Build failures on default branch',
type: sourcegraph.NotificationType.Error,
actions: [
{
command: {
command: 'TODO!(sqs)',
title: 'sourcegraph/codeintellify (31 minutes ago)',
},
},
{
command: {
command: 'TODO!(sqs)',
title: 'sourcegraph/go-diff (7 hours ago)',
},
},
{
command: {
command: 'TODO!(sqs)',
],
},
},
{
command: {
command: 'TODO!(sqs)',
title: 'Change preferred Go version (1.13)',
},
},
],
},
]
: []) as sourcegraph.Notification[]),
{
message: 'Missing Travis CI configuration',
type: sourcegraph.NotificationType.Warning,
actions: [
{
plan: {
title: 'Infer .travis.yml (best-effort) for repositories lacking it',
operations: [
{
command: {
command: 'TODO!(sqs)',
},
},
],
},
},
],
},
])
import * as sourcegraph from 'sourcegraph'
import { Unsubscribable, Subscription } from 'rxjs'
const STATUSES: (sourcegraph.Status & { name: string })[] = [
{
name: 'code-churn',
title: 'Code churn',
state: {
completion: sourcegraph.CheckResult.Completed,
result: sourcegraph.CheckResult.ActionRequired,
message: 'High code churn detected',
},
notifications: [
{ title: 'my notif1', type: sourcegraph.NotificationType.Info },
{ title: 'my notif2', type: sourcegraph.NotificationType.Error },
],
},
]
export function registerSampleStatusProviders(): Unsubscribable {
const subscriptions = new Subscription()
for (const status of STATUSES) {
subscriptions.add(
sourcegraph.status.registerStatusProvider(status.name, {
provideStatus: () => status,
})
)
}
return subscriptions
}
.map(([ruleId, rulePolicy]) => ({
message: ruleId,
type:
rulePolicy === RulePolicy.Default
? sourcegraph.NotificationType.Warning
: sourcegraph.NotificationType.Error,
}))
return notifications